From 8532812f1eddfadc0bcfad220b283bf5990bba10 Mon Sep 17 00:00:00 2001 From: Christopher Zimmermann Date: Sun, 31 May 2020 08:02:24 +0200 Subject: use zero lineGap, sTypoDescender should be negative According to https://simoncozens.github.io/fonts-and-layout/opentype.html#vertical-metrics-hhea-and-os2 sTypoDescender should be negative and lineGap should be zero. --- write.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/write.c b/write.c index c8a86e4..067732f 100644 --- a/write.c +++ b/write.c @@ -851,7 +851,7 @@ writehhea(FILE* out, FontPtr font) writeULONG(out, 0x00010000); /* version */ writeSHORT(out, FONT_UNITS_CEIL(max_y)); /* ascender */ writeSHORT(out, FONT_UNITS_FLOOR(min_y)); /* descender */ - writeSHORT(out, FONT_UNITS(TWO_SIXTEENTH / 20)); /* lineGap */ + writeSHORT(out, 0); /* lineGap */ writeUSHORT(out, FONT_UNITS(max_awidth)); /* advanceWidthMax */ writeSHORT(out, FONT_UNITS_FLOOR(min_x)); /* minLeftSideBearing */ writeSHORT(out, FONT_UNITS_FLOOR(min_x)); /* minRightSideBearing */ @@ -1017,9 +1017,8 @@ writeOS2(FILE* out, FontPtr font) writeUSHORT(out, 0x20); /* usFirstCharIndex; */ writeUSHORT(out, 0xFFFD); /* usLastCharIndex; */ writeUSHORT(out, FONT_UNITS_CEIL(max_y)); /* sTypoAscender; */ - writeUSHORT(out, -FONT_UNITS_FLOOR(min_y)); /* sTypoDescender; */ - writeUSHORT(out, FONT_UNITS(max_y - min_y)); - /* sTypoLineGap; */ + writeUSHORT(out, FONT_UNITS_FLOOR(min_y)); /* sTypoDescender; */ + writeUSHORT(out, 0); /* sTypoLineGap; */ writeUSHORT(out, FONT_UNITS_CEIL(max_y)); /* usWinAscent; */ writeUSHORT(out, -FONT_UNITS_FLOOR(min_y)); /* usWinDescent; */ writeULONG(out, 3); /* ulCodePageRange1; */ -- cgit v1.2.3