mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
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>
This commit is contained in:
@@ -1,40 +1,21 @@
|
||||
FROM ubuntu:14.04.5
|
||||
MAINTAINER xymostech <xymostech@gmail.com>
|
||||
FROM ubuntu:20.04
|
||||
|
||||
# Install things
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y upgrade \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||
--no-install-recommends --auto-remove \
|
||||
software-properties-common \
|
||||
texlive \
|
||||
wget \
|
||||
fontforge \
|
||||
mftrace \
|
||||
man-db \
|
||||
build-essential \
|
||||
python-fontforge \
|
||||
python-dev \
|
||||
python-pip \
|
||||
pkg-config \
|
||||
libharfbuzz-dev \
|
||||
libfreetype6-dev \
|
||||
libjson-perl \
|
||||
&& add-apt-repository ppa:git-core/ppa \
|
||||
&& apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||
--no-install-recommends --auto-remove \
|
||||
git \
|
||||
texlive-base \
|
||||
texlive-fonts-recommended \
|
||||
fontforge=1:20190801~dfsg-4 \
|
||||
mftrace=1.2.20+git20190918.fd8fef5-2 \
|
||||
build-essential \
|
||||
python3-fontforge=1:20190801~dfsg-4 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
ttfautohint=1.8.3-2build1 \
|
||||
libjson-perl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install fonttools==3.28.0 brotli zopfli
|
||||
|
||||
# Download and compile ttfautohint
|
||||
RUN wget "http://download.savannah.gnu.org/releases/freetype/ttfautohint-1.3.tar.gz" \
|
||||
&& tar -xzf ttfautohint-*.tar.gz \
|
||||
&& cd ttfautohint-*/ \
|
||||
&& ./configure --without-qt \
|
||||
&& make \
|
||||
&& mv frontend/ttfautohint /usr/bin \
|
||||
&& cd .. \
|
||||
&& rm -r ttfautohint-*
|
||||
&& pip3 install fonttools==4.21.1 brotli zopfli
|
||||
|
@@ -7,13 +7,6 @@ Originally based on MathJax font generation
|
||||
The `buildFonts.sh` script should do everything automatically,
|
||||
as long as Docker is installed.
|
||||
|
||||
If you want to try out a change
|
||||
to [the katex-fonts repository](https://github.com/KaTeX/katex-fonts),
|
||||
create a local clone (or download and unpack the ZIP file)
|
||||
and specify the path to this directory as an argument to `buildFonts.sh`.
|
||||
You can also specify a local or remote tarball,
|
||||
e.g. a GitHub download of your own personal feature branch.
|
||||
|
||||
The script `buildFonts.sh` automatically creates Docker images
|
||||
from the supplied `Dockerfile`.
|
||||
It uses the hash of the file to tag the image, so a change to the file
|
||||
|
@@ -1,19 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
shopt -s extglob
|
||||
|
||||
usage() {
|
||||
while [[ $# -gt 1 ]]; do
|
||||
echo "$1" >&2
|
||||
shift
|
||||
done
|
||||
echo "Usage: ${0##*/} [OPTIONS]"
|
||||
echo ""
|
||||
echo "OPTIONS:"
|
||||
echo " -h|--help display this help"
|
||||
echo " --image NAME:TAG use the named docker image [$IMAGE]"
|
||||
exit $1
|
||||
}
|
||||
|
||||
used_fonts=(
|
||||
KaTeX_AMS-Regular
|
||||
KaTeX_Caligraphic-Bold
|
||||
@@ -54,7 +41,7 @@ CONTAINER=
|
||||
trap cleanup EXIT
|
||||
|
||||
LAST_COMMIT_DATE="$(git log -1 --format=%ct -- src/fonts)"
|
||||
IMAGE="katex/fonts:DF-$(openssl sha1 $(dirname "$0")/Dockerfile | tail -c 9)"
|
||||
IMAGE="katex/fonts:DF-$(openssl sha1 dockers/fonts/Dockerfile | tail -c 9)"
|
||||
TMPFILE="$(mktemp "${TMPDIR:-/tmp}/mjf.XXXXXXXX")"
|
||||
FILE="$TMPFILE"
|
||||
pushd "src"
|
||||
@@ -68,7 +55,7 @@ popd
|
||||
# build image if missing
|
||||
if [[ $(docker images "$IMAGE" | wc -l) -lt 2 ]]; then
|
||||
echo "Need to build docker image $IMAGE"
|
||||
docker build --tag "$IMAGE" "$(dirname "$0")"
|
||||
docker build --tag "$IMAGE" "dockers/fonts"
|
||||
fi
|
||||
|
||||
CMDS="set -ex
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Generates fontMetricsData.js
|
||||
PERL="perl"
|
||||
PYTHON=`python2 --version >/dev/null 2>&1 && echo python2 || echo python`
|
||||
PYTHON="python3"
|
||||
|
||||
cd src/metrics
|
||||
cd "$(dirname "$0")/../../src/metrics"
|
||||
$PERL ./mapping.pl | $PYTHON ./extract_tfms.py | $PYTHON ./extract_ttfs.py | $PYTHON ./format_json.py --width > ../fontMetricsData.js
|
||||
|
Reference in New Issue
Block a user