diff options
author | Christopher Zimmermann <madroach@gmerlin.de> | 2020-07-12 15:36:18 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-09-22 22:00:38 +0000 |
commit | 1fa97fdc6dc900728be8523be89096b4cb117d4d (patch) | |
tree | cf1dd024efb093169faa19ea55572b21f6be6c1e | |
parent | facf71184163d50adf0b8fccffcaffa18b7bd277 (diff) |
provide version 5 OS/2 table
this was an attempt to fix linespacing, which did not help, but
would still keep it around to avoid double efforts.
-rw-r--r-- | write.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -980,7 +980,7 @@ writeOS2(FILE* out, FontPtr font) { int i; - writeUSHORT(out, 0x0001); + writeUSHORT(out, 5); /* version */ writeSHORT(out, FONT_UNITS(font->metrics.awidth)); /* xAvgCharWidth; */ writeUSHORT(out, font->weight); /* usWeightClass; */ writeUSHORT(out, font->width); /* usWidthClass; */ @@ -1011,16 +1011,31 @@ writeOS2(FILE* out, FontPtr font) i |= 1 << 5; if (!i) i |= 1 << 6; +#ifndef NO_TYPO_METRICS + i |= 1 << 7; /* USE_TYPO_METRICS instead usWin metrics for line spacing. */ +#endif writeUSHORT(out, i); /* fsSelection; */ writeUSHORT(out, 0x20); /* usFirstCharIndex; */ writeUSHORT(out, 0xFFFD); /* usLastCharIndex; */ writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.ascent)); /* sTypoAscender; */ writeUSHORT(out, FONT_UNITS_FLOOR(font->metrics.descent)); /* sTypoDescender; */ writeUSHORT(out, 0); /* sTypoLineGap; */ +#ifdef NO_TYPO_METRICS + writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.ascent)); /* usWinAscent; */ + writeUSHORT(out, FONT_UNITS_FLOOR(font->metrics.descent)); /* usWinDescent; */ +#else writeUSHORT(out, FONT_UNITS_CEIL(font->metrics.maxY)); /* usWinAscent; */ writeUSHORT(out, -FONT_UNITS_FLOOR(font->metrics.minY)); /* usWinDescent; */ - writeULONG(out, 3); /* ulCodePageRange1; */ - writeULONG(out, 0); /* ulCodePageRange2; */ +#endif + writeULONG(out, 3); /* ulCodePageRange1; */ + writeULONG(out, 0); /* ulCodePageRange2; */ + writeSHORT(out, FONT_UNITS_CEIL(font->metrics.xHeight)); /* sxHeight; */ + writeSHORT(out, FONT_UNITS_CEIL(font->metrics.capHeight)); /* sCapHeight; */ + writeUSHORT(out, 0); /* usDefaultChar; */ + writeUSHORT(out, 20); /* usBreakChar; */ + writeUSHORT(out, 0); /* usMaxContext; */ + writeUSHORT(out, 0); /* usLowerOpticalPointSize; */ + writeUSHORT(out, 0xffff); /* usUpperOpticalPointSize; */ return 0; } |