Skip to content

Commit

Permalink
[outlineCompiler] Always make space the gid2
Browse files Browse the repository at this point in the history
Fixes #880
  • Loading branch information
khaledhosny committed Oct 12, 2024
1 parent feeb474 commit dcd3087
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Lib/ufo2ft/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def makeOfficialGlyphOrder(font, glyphOrder=None):
if ".notdef" in names:
names.remove(".notdef")
order.append(".notdef")
if "space" in names:
names.remove("space")
order.append("space")
for name in glyphOrder:
if name not in names:
continue
Expand Down
14 changes: 7 additions & 7 deletions tests/outlineCompiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,16 @@ def test_compile_tweaked_glyph_order(self, quadufo):

def test_compile_strange_glyph_order(self, quadufo):
"""Move space and .notdef to end of glyph ids
ufo2ft always puts .notdef first.
ufo2ft always puts .notdef and space first.
"""
NEW_ORDER = ["b", "a", "c", "d", "space", ".notdef"]
EXPECTED_ORDER = [
".notdef",
"space",
"b",
"a",
"c",
"d",
"space",
"e",
"f",
"g",
Expand Down Expand Up @@ -924,11 +924,11 @@ def test_duplicate_glyph_names(self, testufo):

result = compileTTF(testufo, useProductionNames=True).getGlyphOrder()

assert result[1] == "ab"
assert result[2] == "ab.1"
assert result[3] == "ab.2"
assert result[4] == "ab.3"
assert result[5] == "ab.4"
assert result[2] == "ab"
assert result[3] == "ab.1"
assert result[4] == "ab.2"
assert result[5] == "ab.3"
assert result[6] == "ab.4"

def test_too_long_production_name(self, testufo):
name = "_".join(("a",) * 16)
Expand Down

0 comments on commit dcd3087

Please sign in to comment.