summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-10-07 00:50:21 +0300
committerRasmus Andersson <rasmus@notion.se>2018-10-11 09:38:31 +0300
commitb095e094dc5851ddfb4e4df3ee2a138a9b63f888 (patch)
tree703e8045bc461b6889d8bea09e6361183c87cbfb
parent011677fc30aa6c3d6b48725563c8e967148c7254 (diff)
downloadinter-b095e094dc5851ddfb4e4df3ee2a138a9b63f888.tar.xz
fontbuild: write constant version info to generated UFOs to minimize git thrash
-rwxr-xr-xmisc/fontbuild24
1 files changed, 14 insertions, 10 deletions
diff --git a/misc/fontbuild b/misc/fontbuild
index 50f2e1629..998739f35 100755
--- a/misc/fontbuild
+++ b/misc/fontbuild
@@ -127,11 +127,15 @@ class VarFontProject(FontProject):
self.save_otfs(ufos, ttf=True, interpolatable=True, **kwargs)
-def updateFontVersion(font, updateCreated=True):
+def updateFontVersion(font, dummy=False):
version = getVersion()
buildtag = getGitHash()
- versionMajor, versionMinor = [int(num) for num in version.split(".")]
now = datetime.datetime.utcnow()
+ if dummy:
+ version = "1.0"
+ buildtag = "src"
+ now = datetime.datetime(2016, 1, 1, 0, 0, 0, 0)
+ versionMajor, versionMinor = [int(num) for num in version.split(".")]
font.info.version = version
font.info.versionMajor = versionMajor
font.info.versionMinor = versionMinor
@@ -139,15 +143,15 @@ def updateFontVersion(font, updateCreated=True):
font.info.woffMinorVersion = versionMinor
font.info.year = now.year
font.info.openTypeNameVersion = "%s;%s" % (version, buildtag)
- font.info.openTypeNameUniqueID = "%s %s:%d:%s" % (font.info.familyName, font.info.styleName, now.year, buildtag)
- if updateCreated:
- # creation date & time (YYYY/MM/DD HH:MM:SS)
- font.info.openTypeHeadCreated = now.strftime("%Y/%m/%d %H:%M:%S")
+ font.info.openTypeNameUniqueID = "%s %s:%d:%s" % (
+ font.info.familyName, font.info.styleName, now.year, buildtag)
+ # creation date & time (YYYY/MM/DD HH:MM:SS)
+ font.info.openTypeHeadCreated = now.strftime("%Y/%m/%d %H:%M:%S")
# setFontInfo patches font.info
#
-def setFontInfo(font, weight, updateCreated=True):
+def setFontInfo(font, weight):
#
# For UFO3 names, see
# https://github.com/unified-font-object/ufo-spec/blob/gh-pages/versions/
@@ -162,8 +166,8 @@ def setFontInfo(font, weight, updateCreated=True):
# weight
font.info.openTypeOS2WeightClass = weight
- # version
- updateFontVersion(font, updateCreated=updateCreated)
+ # version (dummy)
+ updateFontVersion(font, dummy=True)
# Names
family_nosp = re.sub(r'\s', '', family)
@@ -432,7 +436,7 @@ class Main(object):
def _glyphsyncWriteUFO(self, font, weight, ufo_path):
# fixup font info
- setFontInfo(font, weight, updateCreated=False)
+ setFontInfo(font, weight)
# cleanup lib
lib = dict()