ab-glyph
ab-glyph copied to clipboard
Change default pixel scaling method
The current PxScale
method was inherited from rusttype and defines the pixel height of glyphs in pixels. There are different ways that users would expect this work.
My current thoughts:
- I don't want multiple px scale concepts inside ab-glyph. One is ok, and you should be able to convert that to any other.
- Changing how it's done would clearly be breaking.
- It would be nice to handle this in the least surprising & most common way as default.
Related: #11, #14
A possible reference:
96px in fontforge(left), chrome(center) and ab-glyph(right, scale_factor = px / font.units_per_em())
font-size should be in pixels-per-em. If users want something else they can do the calculations themselves from metrics in the head/os2 tables (not sure if ab_glyph exposes these)
for example, I use cap-height to size UI buttons. Though, I am not using ab_glyph because it does not support opentype features, but I am using ab_glyph_rasterizer which has a better API than anything else on crates.io