From 851f8547fdbcbbc802bfcd07cc536f93355169a1 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Wed, 13 Aug 2025 01:01:27 +0200 Subject: [PATCH] =?UTF-8?q?Properly=20handle=20=E2=80=98Bold=20Italic?= =?UTF-8?q?=E2=80=99=20subfamily?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ttf2web.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ttf2web.py b/ttf2web.py index b3b4631..97a706e 100755 --- a/ttf2web.py +++ b/ttf2web.py @@ -66,13 +66,8 @@ def __init__(self, fontfile, uranges, assetdir="assets", fontstyle=None, fontwei subfamily = font['name'].getDebugName(2) font.close() - self.fontstyle = fontstyle - if fontstyle is None: - self.fontstyle = 'italic' if subfamily == 'Italic' else 'normal' - - self.fontweight = fontweight - if fontweight is None: - self.fontweight = '700' if subfamily == 'Bold' else '400' + self.fontstyle = fontstyle or ('italic' if 'Italic' in subfamily else 'normal') + self.fontweight = fontweight or ('700' if 'Bold' in subfamily else '400') def _writeCssRule(self, handle, url, unicoderange): print('@font-face {', file=handle)