summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Zimmermann <madroach@gmerlin.de>2020-06-16 18:43:12 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2020-09-22 22:00:38 +0000
commitf8fa7919397659fb0ac5dade75152343d57f20ce (patch)
treea29a7c12c01d158fbc374b2c02af44665992a955
parent1df352c9e862686692ac053b838d76a36d721805 (diff)
correctly set OS2 fsSelection for italic and bold fonts
-rw-r--r--write.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/write.c b/write.c
index 067732f..6ad09a6 100644
--- a/write.c
+++ b/write.c
@@ -1013,7 +1013,14 @@ writeOS2(FILE* out, FontPtr font)
writeULONG(out, 0x03FF); /* ulUnicodeRange3; */
writeULONG(out, 0U); /* ulUnicodeRange4; */
writeULONG(out, font->foundry); /* achVendID[4]; */
- writeUSHORT(out, 0x0040); /* fsSelection; */
+ i = 0;
+ if (font->flags & FACE_ITALIC)
+ i |= 1 << 0;
+ if (font->flags & FACE_BOLD)
+ i |= 1 << 5;
+ if (!i)
+ i |= 1 << 6;
+ writeUSHORT(out, i); /* fsSelection; */
writeUSHORT(out, 0x20); /* usFirstCharIndex; */
writeUSHORT(out, 0xFFFD); /* usLastCharIndex; */
writeUSHORT(out, FONT_UNITS_CEIL(max_y)); /* sTypoAscender; */