fix(fonts): fix the timestamp of fonts to the epoch (#3370)

* fix: fix the timestamp of fonts to the epoch

* fix: update fonts

Co-authored-by: Erik Demaine <edemaine@mit.edu>
This commit is contained in:
ylemkimon
2021-10-30 04:08:22 +09:00
committed by GitHub
parent 052f0006f1
commit dde05db6b7
64 changed files with 3 additions and 13 deletions

View File

@@ -15,13 +15,12 @@ if len(sys.argv) < 2:
font_file = sys.argv[1]
font_name = os.path.splitext(os.path.basename(font_file))[0]
# now or SOURCE_DATE_EPOCH, if present
timestamp = timestampNow()
font = TTFont(font_file, recalcBBoxes=False, recalcTimestamp=False)
font['head'].created = timestamp
font['head'].modified = timestamp
# fix timestamp to the epoch
font['head'].created = 0
font['head'].modified = 0
# remove fontforge timestamps
if 'FFTM' in font:
@@ -36,8 +35,6 @@ if 'GDEF' in font:
font['name'].names = [record for record in font['name'].names if record.platformID != 1]
font['cmap'].tables = [table for table in font['cmap'].tables if table.platformID != 1]
font['name'].setName('Version ' + str(timestamp), 5, 3, 1, 1033)
# fix OS/2 and hhea metrics
glyf = font['glyf']
ascent = int(max(glyf[c].yMax for c in font.getGlyphOrder() if hasattr(glyf[c], "yMax")))