Skip to content

Commit ea409ea

Browse files
ylemkimonedemaine
andauthored
fix(fonts): update fonts dependencies (#2866)
* fix(fonts): update fonts dependencies * chore(fonts): fix buildMetrics for Python 3 * fix(fonts): update fonts * test: update screenshots * docs: update reference to katex-fonts * chore: use Python 3 * fix(fonts): update fonts * test: update screenshots * Use explicit path * Command-line arguments aren't actually supported * Small buildMetrics fixes * Add build:{fonts,metrics} script * Lock versions of font-related dependencies * Install minimal texlive * Install fontforge Co-authored-by: Erik Demaine <edemaine@mit.edu>
1 parent 6fa1adb commit ea409ea

File tree

432 files changed

+39
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+39
-76
lines changed

dockers/fonts/Dockerfile

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,21 @@
1-
FROM ubuntu:14.04.5
2-
MAINTAINER xymostech <xymostech@gmail.com>
1+
FROM ubuntu:20.04
32

43
# Install things
54
RUN apt-get update \
65
&& DEBIAN_FRONTEND=noninteractive apt-get -y upgrade \
76
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
87
--no-install-recommends --auto-remove \
9-
software-properties-common \
10-
texlive \
11-
wget \
12-
fontforge \
13-
mftrace \
14-
man-db \
8+
git \
9+
texlive-base \
10+
texlive-fonts-recommended \
11+
fontforge=1:20190801~dfsg-4 \
12+
mftrace=1.2.20+git20190918.fd8fef5-2 \
1513
build-essential \
16-
python-fontforge \
17-
python-dev \
18-
python-pip \
19-
pkg-config \
20-
libharfbuzz-dev \
21-
libfreetype6-dev \
14+
python3-fontforge=1:20190801~dfsg-4 \
15+
python3-dev \
16+
python3-pip \
17+
ttfautohint=1.8.3-2build1 \
2218
libjson-perl \
23-
&& add-apt-repository ppa:git-core/ppa \
24-
&& apt-get update \
25-
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
26-
--no-install-recommends --auto-remove \
27-
git \
2819
&& apt-get clean \
2920
&& rm -rf /var/lib/apt/lists/* \
30-
&& pip install fonttools==3.28.0 brotli zopfli
31-
32-
# Download and compile ttfautohint
33-
RUN wget "http://download.savannah.gnu.org/releases/freetype/ttfautohint-1.3.tar.gz" \
34-
&& tar -xzf ttfautohint-*.tar.gz \
35-
&& cd ttfautohint-*/ \
36-
&& ./configure --without-qt \
37-
&& make \
38-
&& mv frontend/ttfautohint /usr/bin \
39-
&& cd .. \
40-
&& rm -r ttfautohint-*
21+
&& pip3 install fonttools==4.21.1 brotli zopfli

dockers/fonts/README.md

Lines changed: 0 additions & 7 deletions

dockers/fonts/buildFonts.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
#!/usr/bin/env bash
22
shopt -s extglob
33

4-
usage() {
5-
while [[ $# -gt 1 ]]; do
6-
echo "$1" >&2
7-
shift
8-
done
9-
echo "Usage: ${0##*/} [OPTIONS]"
10-
echo ""
11-
echo "OPTIONS:"
12-
echo " -h|--help display this help"
13-
echo " --image NAME:TAG use the named docker image [$IMAGE]"
14-
exit $1
15-
}
16-
174
used_fonts=(
185
KaTeX_AMS-Regular
196
KaTeX_Caligraphic-Bold
@@ -54,7 +41,7 @@ CONTAINER=
5441
trap cleanup EXIT
5542

5643
LAST_COMMIT_DATE="$(git log -1 --format=%ct -- src/fonts)"
57-
IMAGE="katex/fonts:DF-$(openssl sha1 $(dirname "$0")/Dockerfile | tail -c 9)"
44+
IMAGE="katex/fonts:DF-$(openssl sha1 dockers/fonts/Dockerfile | tail -c 9)"
5845
TMPFILE="$(mktemp "${TMPDIR:-/tmp}/mjf.XXXXXXXX")"
5946
FILE="$TMPFILE"
6047
pushd "src"
@@ -68,7 +55,7 @@ popd
6855
# build image if missing
6956
if [[ $(docker images "$IMAGE" | wc -l) -lt 2 ]]; then
7057
echo "Need to build docker image $IMAGE"
71-
docker build --tag "$IMAGE" "$(dirname "$0")"
58+
docker build --tag "$IMAGE" "dockers/fonts"
7259
fi
7360

7461
CMDS="set -ex

dockers/fonts/buildMetrics.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
# Generates fontMetricsData.js
33
PERL="perl"
4-
PYTHON=`python2 --version >/dev/null 2>&1 && echo python2 || echo python`
4+
PYTHON="python3"
55

6-
cd src/metrics
6+
cd "$(dirname "$0")/../../src/metrics"
77
$PERL ./mapping.pl | $PYTHON ./extract_tfms.py | $PYTHON ./extract_ttfs.py | $PYTHON ./format_json.py --width > ../fontMetricsData.js

docs/font.md

Lines changed: 1 addition & 1 deletion

fonts/KaTeX_AMS-Regular.ttf

14.9 KB
Binary file not shown.

fonts/KaTeX_AMS-Regular.woff

8.48 KB
Binary file not shown.

fonts/KaTeX_AMS-Regular.woff2

6.95 KB
Binary file not shown.

fonts/KaTeX_Caligraphic-Bold.ttf

600 Bytes
Binary file not shown.

fonts/KaTeX_Caligraphic-Bold.woff

304 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)