src/vs/editor/browser/controller/textAreaHandler.ts/measureText
function measureText(text: string, fontInfo: BareFontInfo): number {
	if (text.length === 0) {
		return 0;
	}

	const container = document.createElement('div');
	container.style.position = 'absolute';
	container.style.top = '-50000px';
	container.style.width = '50000px';

	const regularDomNode = document.createElement('span');
	applyFontInfo(regularDomNode, fontInfo);
	regularDomNode.style.whiteSpace = 'pre'; // just like the textarea
	regularDomNode.append(text);
	container.appendChild(regularDomNode);

	document.body.appendChild(container);

	const res = regularDomNode.offsetWidth;

	document.body.removeChild(container);

	return res;
}