Skip to content

Commit

Permalink
font-patcher: Ensure PostScript font name does not contain spaces
Browse files Browse the repository at this point in the history
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 ryanoasis#413
  • Loading branch information
torarnv committed Apr 10, 2022
1 parent aabed73 commit 68130bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,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
#
Expand Down

0 comments on commit 68130bd

Please sign in to comment.