font-patcher: Ensure PostScript font name does not contain spaces

When pulling the subfamily out of the sfnt_names SubFamily property,
we will get a subfamily with possible spaces, e.g. 'Bold Italic'.

When constructing the final unique font name (PostScript name), we
need to remove those spaces, to make the font name valid, otherwise
the font will fail validation with a warning when installing.

Fixes #413
This commit is contained in:
Tor Arne Vestbø 2022-04-10 15:33:11 +02:00 committed by Fini Jastrow
parent ccc6f4e546
commit 6acec45622

View file

@ -516,8 +516,9 @@ class font_patcher:
familyname += " Mono"
# Don't truncate the subfamily to keep fontname unique. MacOS treats fonts with
# the same name as the same font, even if subFamily is different.
fontname += '-' + subFamily
# the same name as the same font, even if subFamily is different. Make sure to
# keep the resulting fontname (PostScript name) valid by removing spaces.
fontname += '-' + subFamily.replace(' ', '')
# rename font
#