Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Improve fonts generation: remove unused codes #48

Merged
merged 11 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
--no-install-recommends --auto-remove \
git \
dvipng \
default-jre \
default-jdk \
texlive \
wget \
fontforge \
mftrace \
fonttools \
optipng \
advancecomp \
man-db \
build-essential \
unzip \
zlib1g-dev \
python-fontforge \
ruby \
woff-tools \
Expand All @@ -31,23 +24,6 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& gem install ttfunk --version 1.1.1

# Download yuicompressor
ADD https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar /usr/share/yui-compressor/yui-compressor.jar

# Download batik-ttf2svg.jar
RUN wget "https://archive.apache.org/dist/xmlgraphics/batik/batik-1.7.zip" \
&& unzip batik-*.zip batik-*/batik-ttf2svg.jar \
&& mv batik-*/batik-ttf2svg.jar /usr/share/java/ \
&& rm -r batik-*

# Download and compile ttf2eof (note we add a patch to make it compile)
RUN wget "https://github.com/wget/ttf2eot/archive/v0.0.2-2.tar.gz" -O ttf2eot.tar.gz\
&& tar -xzf ttf2eot.tar.gz \
&& sed -i "1s/^/#include <cstddef>/" ttf2eot-*/OpenTypeUtilities.h \
&& make -C ttf2eot-*/ \
&& mv ttf2eot-*/ttf2eot /usr/bin/ \
&& rm -r ttf2eot*

# Download and compile ttfautohint
RUN wget "http://download.savannah.gnu.org/releases/freetype/ttfautohint-1.3.tar.gz" \
&& tar -xzf ttfautohint-*.tar.gz \
Expand Down
15 changes: 0 additions & 15 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ help:
@echo "make config"
@echo " Generate the Perl configuration"
@echo ""
@echo "make fonts"
@echo " Generate and install MathJax fonts and related data."
@echo ""
@echo "make pack"
@echo " Run MathJax packer"
@echo ""
@echo "make clean"
@echo " Remove temporary directories and files."
@echo ""
Expand All @@ -53,14 +47,5 @@ $(CUSTOM).pl: $(CUSTOM)

config: $(CUSTOM).pl

fonts: $(CUSTOM).pl
$(MAKE) -C fonts all

pack: $(CUSTOM).pl
$(MAKE) -C packer all

clean:
rm -f $(CUSTOM).pl
$(MAKE) -C fonts clean

.PHONY: fonts
27 changes: 1 addition & 26 deletions src/default.cfg
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
# Note: paths should be absolute, unless they point to programs in your $PATH.

##### Standard programs #####
DVIPNG=dvipng
FILE=file
GREP=grep
JAVA=java
LATEX=latex
PERL=perl
PYTHON=python
SED=sed
WGET=wget
WHICH=which

##### Installation directories #####
# The MathJax TeX fonts will be created in FONTDIR. It is assumed that the
# STIX fonts (http://stixfonts.org/) are already contained in that directory.
# MATHJAXDIR is the path of the MathJax installation to update.
FONTDIR=
MATHJAXDIR=

##### Font tools #####
# Most of the tools below are standard and should be available from your package
# manager. Batik >= 1.7 (http://xmlgraphics.apache.org/batik/) is required and
# TTF2SVG should point to the absolute path of batik-ttf2svg.jar JAR file.
# For TTF2EOT and SFNT2WOFF, see https://code.google.com/p/ttf2eot/ and
# http://people.mozilla.org/~jkew/woff/ respectively.
# Most of the tools below are standard and should be available from your package manager.
FONTFORGE=fontforge
MFTRACE=mftrace
SFNT2WOFF=sfnt2woff
TTF2EOT=ttf2eot
TTF2SVG=/usr/share/java/batik-ttf2svg.jar
TTX=ttx
WOFF2=woff2_compress
TTFAUTOHINT=ttfautohint

#### Image compression tools ####
OPTIPNG=optipng
ADVPNG=advpng

##### TeXLive Encoding
TETEXENCODING=/usr/share/texlive/texmf-texlive/fonts/enc/dvips/tetex/
BASEENCODING=/usr/share/texlive/texmf-texlive/fonts/enc/dvips/base/

##### packer #####
YUICOMPRESSOR=/usr/share/yui-compressor/yui-compressor.jar
3 changes: 0 additions & 3 deletions src/fonts/OTF/TeX/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
lib/blacker.mf
lib/mftrace-modified
css
eot
ff
otf
pfa
svg
ttf
woff
woff2
63 changes: 4 additions & 59 deletions src/fonts/OTF/TeX/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include ../../../custom.cfg

MFTRACE_MODIFIED=lib/mftrace-modified

all: fonts install
all: fonts

blacker: $(MFTRACE_MODIFIED)
$(MFTRACE_MODIFIED):
Expand Down Expand Up @@ -112,7 +112,7 @@ ttf: ff

@for file in `ls ttf/*.ttf`; do \
echo "hinting $$file"; \
if echo "$$file" | $(GREP) -q -e "Greek" -e "Size[1-4]" -e "Typewriter" -e "Win"; then \
if echo "$$file" | $(GREP) -q -e "Size[1-4]" -e "Typewriter"; then \
$(TTFAUTOHINT) --windows-compatibility --symbol $$file $$file.hinted; \
else \
$(TTFAUTOHINT) --windows-compatibility $$file $$file.hinted; \
Expand All @@ -121,28 +121,6 @@ ttf: ff
done

./fix_os2_metrics.rb ttf/
eot: ttf
mkdir -p eot
rm -f eot/*

@for file in `ls ttf/*.ttf | $(SED) 's|ttf/\(.*\)\.ttf|\1|'`; do \
echo "Generating $$file.eot..."; \
$(TTF2EOT) < ttf/$$file.ttf > eot/$$file.eot; \
done

rm -f eot/*WinChrome* eot/*Greek*

svg: ttf
mkdir -p svg
rm -f svg/*

@for file in `ls ttf/*.ttf | $(SED) 's|ttf/\(.*\)\.ttf|\1|'`; do \
echo "Generating $$file.svg..."; \
$(JAVA) -jar $(TTF2SVG) ttf/$$file.ttf \
-id $$file -o svg/$$file.svg -l 0 -h 65535; \
done

rm -f svg/*WinIE6* svg/*Greek*

woff: otf ttf
@for file in `ls ttf/*.ttf | $(SED) 's|ttf/\(.*\)\.ttf|\1|'`; do \
Expand All @@ -153,7 +131,6 @@ woff: otf ttf
mkdir -p woff
rm -f woff/*
mv ttf/*.woff woff
rm -f woff/*WinChrom* woff/*WinIE6* woff/*Greek*

woff2: woff
@for file in `ls ttf/*.ttf | $(SED) 's|ttf/\(.*\)\.ttf|\1|'`; do \
Expand All @@ -164,43 +141,11 @@ woff2: woff
mkdir -p woff2
rm -f woff2/*
mv ttf/*.woff2 woff2
rm -f woff2/*WinChrom* woff2/*WinIE6* woff2/*Greek*

css: woff
mkdir -p css
rm -f css/*

@for file in `ls woff/*.woff | $(SED) 's|woff/\(.*\)\.woff|\1|'`; do \
echo "Generating $$file.css..."; \
$(PERL) woff2css $$file > css/$$file.css; \
end

$(PERL) css2all css/*.css > KaTeX-All.css
mv KaTeX-All.css css

OTFandTTF: ttf

fonts: OTFandTTF eot svg woff # css

install:
#Copy the font files into the system font directory
#rm -f $FONTDIR/KaTeX_*
cp `ls otf/*.otf | $(GREP) -v 'Greek'` $(FONTDIR)
# echo `ls ttf/*.ttf | $(GREP) -Ev 'WinChro|WinIE6'`
cp ttf/*Greek*.ttf $(FONTDIR)

# Put the fonts into the KaTeX fonts folder
rm -f $(MATHJAXDIR)/fonts/HTML-CSS/TeX/otf/*.*
rm -f $(MATHJAXDIR)/fonts/HTML-CSS/TeX/eot/*.*
rm -f $(MATHJAXDIR)/fonts/HTML-CSS/TeX/svg/*.*
rm -f $(MATHJAXDIR)/fonts/HTML-CSS/TeX/woff/*.*
#rm -f $(MATHJAXDIR)/fonts/HTML-CSS/TeX/css/*.*
cp `ls otf/*.otf | $(GREP) -v 'Greek'` $(MATHJAXDIR)/fonts/HTML-CSS/TeX/otf
cp eot/*.eot $(MATHJAXDIR)/fonts/HTML-CSS/TeX/eot
cp svg/*.svg $(MATHJAXDIR)/fonts/HTML-CSS/TeX/svg
cp woff/*.woff $(MATHJAXDIR)/fonts/HTML-CSS/TeX/woff
#cp css/*.css $(MATHJAXDIR)/fonts/HTML-CSS/TeX/css
fonts: OTFandTTF woff woff2

clean:
rm -f $(MFTRACE_MODIFIED) lib/blacker.mf
rm -rf pfa ff otf ttf eot svg woff css
rm -rf pfa ff otf ttf woff woff2
14 changes: 0 additions & 14 deletions src/fonts/OTF/TeX/lib/makeSkew.js

This file was deleted.

Loading