diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py index d49afdca0..49e98d034 100644 --- a/Lib/fontTools/ttLib/tables/S_V_G_.py +++ b/Lib/fontTools/ttLib/tables/S_V_G_.py @@ -110,7 +110,9 @@ class table_S_V_G_(DefaultTable.DefaultTable): if (allCompressed or doc.compressed) and not docBytes.startswith(b"\x1f\x8b"): import gzip bytesIO = BytesIO() - with gzip.GzipFile(None, "w", fileobj=bytesIO) as gzipper: + # mtime=0 strips the useless timestamp and makes gzip output reproducible; + # equivalent to `gzip -n` + with gzip.GzipFile(None, "w", fileobj=bytesIO, mtime=0) as gzipper: gzipper.write(docBytes) gzipped = bytesIO.getvalue() if len(gzipped) < len(docBytes): diff --git a/Tests/ttLib/tables/S_V_G__test.py b/Tests/ttLib/tables/S_V_G__test.py index 9a6e33e30..4c40556e2 100644 --- a/Tests/ttLib/tables/S_V_G__test.py +++ b/Tests/ttLib/tables/S_V_G__test.py @@ -16,7 +16,7 @@ def dump(table, ttFont=None): def compress(data: bytes) -> bytes: buf = io.BytesIO() - with gzip.GzipFile(None, "w", fileobj=buf) as gz: + with gzip.GzipFile(None, "w", fileobj=buf, mtime=0) as gz: gz.write(data) return buf.getvalue()