summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-09-12 09:41:01 +0300
committerRasmus Andersson <rasmus@notion.se>2018-09-12 09:41:01 +0300
commit041342d1996c1f9ec71eafa3d5e9f9276367b128 (patch)
tree62f2583f0acab6211d58589528d19663c939e345
parent6716234d46e10624cf2483188ded08dba0e5f832 (diff)
downloadinter-041342d1996c1f9ec71eafa3d5e9f9276367b128.tar.xz
fontbuild: Clear anchors in generated UFOs and rename italic UFO
-rwxr-xr-xmisc/fontbuild25
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)]