Closed TakWolf closed 4 years ago
ab-glyph doesn't use units_per_em
for scale, it follows the rusttype method. So using PxScale
24
means the font height will be 24 pixels (I wasn't aware of any better way at the time).
You can just make your own calculation and apply it to scales if you need consistency with something else.
Thank yout.
I want to know what is the standard practice? Could I believe rusttype? I can't find a reference and prefer chrome, because it seems more authoritative.
~~Now there is a only way to draw font thar is to use OutlinedGlyph
,
And OutlinedGlyph
have a Glyph
(with a scale)
How to get a font drawer without hack scale?~~
I want to know what is the standard practice? Could I believe rusttype? I can't find a reference and prefer chrome, because it seems more authoritative.
I've raised an issue to discuss this #15. Changing would involve a breaking version increment, but I'd certainly consider it if the new pixel scaling was considerably more "standard".
For example:
output:
In font Roboto, units per em = 1000, height = 1448 so the text rasterize seems smaller.
Font size is 24px, left is in chrome, right is in ab_glyph.
I am not sure which is correct, but I found in another font parse library fontdue: It use units_per_em.
https://github.com/mooman219/fontdue/blob/master/src/font.rs#L243-L247
======================
I try to adjust the scale factory to fit units_per_em, it seems size equal:
======================================= Chrome demo: http://static.takwolf.com/font-test/index.html https://github.com/TakWolf/static.takwolf.com/blob/master/font-test/index.html
ab-glyph demo: https://github.com/TakWolf/tge/blob/feature/ab-glyph/examples/text_layout.rs