Skip to content

1em is font size, not height

madroach requested to merge madroach/fonttosfnt:master into master

Hi,

when implementing the metrics calculations I worked under the wrong assumption that 1 em is the font height. It isn't. It's the font design size. This makes a (sometimes noticeable) difference when the bdf font's FONT_ASCENT + FONT_DESCENT differs from PIXEL_SIZE. Anyway. This commit will get it right, hopefully without breaking other stuff.

I noticed this when converting the Dina font port on OpenBSD. Dina has a line height (ascent+descent) much greater than the font size. This resulted in lines getting too tight.

Hey, @FrankSteiner and @jfriesse, it would be great if you guys could try out what this does to Helvetica and Courier in your setups. Interestingly for Courier the ascent+descent is smaller then the font size. For helvetica it's the opposite.

Edited by madroach

Merge request reports