Skip to content

Commit

Permalink
Only ignore Zinh, Zyyy and Zzzz
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Sep 3, 2023
1 parent e4749e9 commit 2aa6ce5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Lib/gftools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,12 @@ def remove_url_prefix(url):

def primary_script(ttFont, ignore_latin=True):
g = classifyGlyphs(lambda uv:list(ftunicodedata.script_extension(chr(uv))), ttFont.getBestCmap(), gsub=ttFont.get("GSUB"))
badkeys = [key for key in g.keys() if key.startswith("Z")]
if "Latn" in g and ignore_latin:
badkeys = ["Zinh", "Zyyy", "Zzzz"]
if ignore_latin:
badkeys.append("Latn")
for badkey in badkeys:
del g[badkey]
if badkey in g:
del g[badkey]
script_count = Counter({k:len(v) for k,v in g.items()})

# If there isn't a clear winner, give up
Expand Down

0 comments on commit 2aa6ce5

Please sign in to comment.