4 ms·
Nice. I plan to use this tool to pre-calculate the letter size ratios for all my fonts, then bake those into my non-JS server code as constants and use a simila
by RadiozRadioz 2y ago
Nice. I plan to use this tool to pre-calculate the letter size ratios for all my fonts, then bake those into my non-JS server code as constants and use a similar wrapping algorithm. Now there's no runtime canvassing. Thanks for this code
- tln 2y agoYou'd need more than just letter widths because of kerning and ligatures, for 100% accuracy. Anyway, fontkit can work on the server and can get individual glyph metrics as well as metrics for a run of glyphs. https://github.com/foliojs/fontkit https://github.com/foliojs/fontkit
- leeoniya 2y agoyep, uWrap internally builds a lookup table for char pairs that differ significantly in width together from just adding their raw widths.
- RadiozRadioz 2y agoI don't use ligatures and my solution to the keming problem is to overprovision. Thanks for the link though.