diff options
author | Rasmus Andersson <rasmus@notion.se> | 2018-09-12 09:41:01 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2018-10-11 09:37:37 +0300 |
commit | bbefc90d4b0bab6eb71b0e64ca07e8e22a169b26 (patch) | |
tree | e06bd109fdfc882d6f0240ae2a52f05e6d756154 /misc | |
parent | d064cad96fecb907593d9659be6ebcde76c3ecfa (diff) | |
download | inter-bbefc90d4b0bab6eb71b0e64ca07e8e22a169b26.tar.xz |
fontbuild: Clear anchors in generated UFOs and rename italic UFO
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/fontbuild | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/misc/fontbuild b/misc/fontbuild index fd071b1c3..7a327554f 100755 --- a/misc/fontbuild +++ b/misc/fontbuild @@ -166,7 +166,7 @@ def setFontInfo(font, weight, updateCreated=True): # - Medium => "Family Medium", ("regular" | "italic") # - Black => "Family Black", ("regular" | "italic") # and so on. - subfamily = stripItalic(style) # "A Italic" => "A", "A" => "A" + subfamily = stripItalic(style).strip() # "A Italic" => "A", "A" => "A" if len(subfamily) == 0: subfamily = "Regular" subfamily_lc = subfamily.lower() @@ -185,7 +185,7 @@ def setFontInfo(font, weight, updateCreated=True): else: font.info.styleMapStyleName = "bold" else: - font.info.styleMapFamilyName = family + ' ' + subfamily + font.info.styleMapFamilyName = (family + ' ' + subfamily).strip() # name ID 2 "Subfamily name" (legacy, but required) if isitalic: font.info.styleMapStyleName = "italic" @@ -467,8 +467,17 @@ class Main(object): # no need to also set the relative 'filename' attribute as that # will be auto-updated on writing the designspace document - # name "Inter UI Black" => "black" - source.name = source.styleName.lower().replace(' ', '') + if source.styleName == "Italic Italic": + # Workaround for Glyphs limitation + # (Base italic master can't be called just Italic, so it's called + # "Italic Italic" which is converted here to just "Italic") + ufo_path = pjoin(master_dir, 'Inter-UI-Italic.ufo') + source.styleName = "Italic" + source.name = "italic" + source.font.info.styleName = "Italic" + else: + # name "Inter UI Black" => "black" + source.name = source.styleName.lower().replace(' ', '') # fixup font info weight = int(source.location['Weight']) @@ -485,6 +494,10 @@ class Main(object): source.font.lib.clear() source.font.lib.update(lib) + # clear anchors + for g in source.font: + g.clearAnchors() + # write UFO file source.path = ufo_path self.log("write %s" % relpath(ufo_path, os.getcwd())) @@ -563,6 +576,10 @@ class Main(object): italicAngle = float(italicAngle) del font.lib[italicAngleKey] font.info.italicAngle = italicAngle + + # clear anchors + for g in font: + g.clearAnchors() # update font info weight = instance_weight[basename(font.path)] |