measureText = function(textObj) {
const ctx = DOM.context2d(1, 1),
dpi = 96,
fontFamily = textObj.fontFamily ? textObj.fontFamily : "Arial, sans-serif",
fontSize = textObj.fontSize ? `${textObj.fontSize}in` : `0.1in`,
value = textObj.value ? textObj.value : "ABC",
fontString = `${fontSize} ${fontFamily}`;
ctx.font = fontString;
let text = ctx.measureText(value);
return text.width / dpi;
}