Open Noeilnoeil17 opened 1 year ago
Me too on this. Changing fonts, changing font sizes, nothing seems to change the results - all zeros except for the width and that value never changes regardless of the length of text, the font etc.
Hi bigDave1357, thanks for your feedback, for now, only solution is using javascript...
function measuretextincanvas(font, text, mmToPix) { var canvas = document.getElementById('hiddencanvas'); var ctx = canvas.getContext('2d'); ctx.font = font; var TextWidth = ctx.measureText(text).width / mmToPix; var TextHeight = ctx.measureText("H").actualBoundingBoxAscent / mmToPix; return { TextWidth, TextHeight }; }
Noeilnoeil17
Hi @Noeilnoeil17, thanks for your assistance. I figured the same. My app needs to manipulate font sizes based on an auto-fit scenario as well as render lots of text, and I suspect I'll be better just using JS for the whole solution. Seems pointless that I have an extension for part of the work if I have to reach down into JS anyway. Kind of defeats the purpose of the extension. I'll probably get better performance working directly with JS anyway. So I'll ditch the extension.
Hi @bigDave1357 - could You help me to start with JS without this Extension ?
Hi everybody,
Enjoy with this extensions, thanks a lot When i try to use _context.MesureTextAsync, only width parameter is present, all other return 0 :-(
just tested with this simple test :
Any help is welcome, thanks,
Noeilnoeil17