File 0005-correctly-set-OS2-fsSelection-for-italic-and-bold-fo.patch of Package fonttosfnt.20912
From 86c6e483c741ac7624d8ed9ceb151f6197238427 Mon Sep 17 00:00:00 2001
From: Christopher Zimmermann <madroach@gmerlin.de>
Date: Tue, 16 Jun 2020 18:43:12 +0200
Subject: [PATCH 05/14] correctly set OS2 fsSelection for italic and bold fonts
---
write.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/write.c b/write.c
index 067732f..64b38b6 100644
--- a/write.c
+++ b/write.c
@@ -1013,7 +1013,11 @@ 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; */
--
2.28.0