mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
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:
2
.github/workflows/fonts.yml
vendored
2
.github/workflows/fonts.yml
vendored
@@ -97,13 +97,11 @@ jobs:
|
||||
|
||||
- name: Build fonts
|
||||
run: |
|
||||
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct -- src/fonts)
|
||||
make -C src/fonts all
|
||||
rm -f fonts/*.*
|
||||
cp src/fonts/ttf/*.ttf fonts
|
||||
cp src/fonts/woff/*.woff fonts
|
||||
cp src/fonts/woff2/*.woff2 fonts
|
||||
echo $SOURCE_DATE_EPOCH > fonts/VERSION
|
||||
|
||||
- name: Build metrics
|
||||
run: ./dockers/fonts/buildMetrics.sh
|
||||
|
@@ -40,7 +40,6 @@ cleanup() {
|
||||
CONTAINER=
|
||||
trap cleanup EXIT
|
||||
|
||||
LAST_COMMIT_DATE="$(git log -1 --format=%ct -- src/fonts)"
|
||||
IMAGE="katex/fonts:DF-$(openssl sha1 dockers/fonts/Dockerfile | tail -c 9)"
|
||||
TMPFILE="$(mktemp "${TMPDIR:-/tmp}/mjf.XXXXXXXX")"
|
||||
FILE="$TMPFILE"
|
||||
@@ -59,7 +58,6 @@ if [[ $(docker images "$IMAGE" | wc -l) -lt 2 ]]; then
|
||||
fi
|
||||
|
||||
CMDS="set -ex
|
||||
export SOURCE_DATE_EPOCH=${LAST_COMMIT_DATE}
|
||||
tar xfP katex-fonts.tar.gz
|
||||
make -C fonts all
|
||||
tar cf /fonts.tar ${filetypes[*]/#/fonts/}"
|
||||
@@ -84,5 +82,3 @@ for filetype in "${filetypes[@]}"; do
|
||||
done
|
||||
done
|
||||
rm -rf temp fonts.tar
|
||||
|
||||
echo $LAST_COMMIT_DATE > fonts/VERSION
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
1630515774
|
@@ -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")))
|
||||
|
Reference in New Issue
Block a user