Skip to content

Commit

Permalink
calcCodePageRanges: always enable at least bit 0 (Latin 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Oct 8, 2018
1 parent c9925b3 commit 15aada1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/ufo2ft/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ def calcCodePageRanges(unicodes):
if hasAscii and "‰" in chars and "∑" in chars:
codepageRanges.add(29) # Macintosh Character Set (US Roman)

# when no codepage ranges can be enabled, fall back to enabling bit 0
#(Latin 1) so that the font works in MS Word:
# https://github.com/googlei18n/fontmake/issues/468
if not codepageRanges:
codepageRanges.add(0)

return codepageRanges


Expand Down
1 change: 1 addition & 0 deletions tests/outlineCompiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ def test_too_long_production_name(self, testufo):
[ASCII + ["┤", "√", "é"], {52}], # MS-DOS Canadian French
[ASCII + ["┤", "√", "õ"], {55}], # MS-DOS Portuguese
[ASCII + ["‰", "∑"], {29}], # Macintosh Character Set (US Roman)
[[" ", "0", "1", "2", "අ"], {0}], # always fallback to Latin 1
],
)
def test_calcCodePageRanges(emptyufo, unicodes, expected):
Expand Down

0 comments on commit 15aada1

Please sign in to comment.