ab-glyph icon indicating copy to clipboard operation
ab-glyph copied to clipboard

Change default pixel scaling method

Open alexheretic opened this issue 3 years ago • 2 comments

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

alexheretic avatar Aug 06 '20 15:08 alexheretic

A possible reference:

96px in fontforge(left), chrome(center) and ab-glyph(right, scale_factor = px / font.units_per_em())

image image

TakWolf avatar Sep 02 '20 08:09 TakWolf

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

LoganDark avatar Jun 11 '22 23:06 LoganDark