Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(font): rewrite makeFF in Python #3714

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
refactor: better .pfa/.pfb generation code
The old version was a big list of commands to `mftrace` in a single
target. Now the code uses a pattern to create the different files in a
more idiomatic way.

It is not necessary to explicitly state the encoding for some files.
The `mftrace` script can always find the correct encoding
automatically.
  • Loading branch information
IvoWingelaar committed Sep 17, 2022
commit 84f6ec3d0c43807910bffc16c508913858d05f1f
90 changes: 29 additions & 61 deletions src/fonts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 24,26 @@ CUSTOM=custom.cfg

MFTRACE_MODIFIED=lib/mftrace-modified

PFA := \
cmbsy10.pfa \
cmbx10.pfa \
cmbxti10.pfa \
cmex10.pfa \
cmmi10.pfa \
cmmib10.pfa \
cmr10.pfa \
cmss10.pfa \
cmssbx10.pfa \
cmssi10.pfa \
cmsy10.pfa \
cmti10.pfa \
cmtt10.pfa \
msam10.pfa \
msbm10.pfa \
rsfs10.pfa \
eufb10.pfb \
eufm10.pfb

all: config fonts

$(CUSTOM):
Expand All @@ -39,74 59,22 @@ $(CUSTOM).pl: $(CUSTOM)

.PHONY: config
config: $(CUSTOM).pl
mkdir -p pfa

blacker: $(MFTRACE_MODIFIED)
$(MFTRACE_MODIFIED):
$(PERL) -I. makeBlacker 15 # values between 10 and 30 seem best

pfa: $(MFTRACE_MODIFIED)
@echo "cmr10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmr10

@echo "cmmi10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --encoding $(TETEXENCODING)/aae443f0.enc --simplify cmmi10

@echo "cmsy10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --encoding $(TETEXENCODING)/10037936.enc --simplify cmsy10

@echo "cmex10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmex10

@echo "cmbx10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmbx10

@echo "cmbxti10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmbxti10

@echo "cmti10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmti10

@echo "msam10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify --encoding $(TETEXENCODING)/10037936.enc msam10
# Create the pfa files
%.pfa: $(MFTRACE_MODIFIED)
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify $*
mv $@ pfa/$@

@echo "msbm10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify --encoding $(TETEXENCODING)/10037936.enc msbm10

@echo "cmmib10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --encoding $(TETEXENCODING)/aae443f0.enc --simplify cmmib10

@echo "cmbsy10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --encoding $(TETEXENCODING)/10037936.enc --simplify cmbsy10

@echo "cmtt10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmtt10

@echo "cmss10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmss10
@echo "cmssi10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmssi10
@echo "cmssbx10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify cmssbx10

@echo "eufm10"
cp "`$(KPSEWHICH) eufm10.pfb`" eufm10.pfb
@echo "eufb10"
cp "`$(KPSEWHICH) eufb10.pfb`" eufb10.pfb

# echo "eusm10"
# $(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify eusm10
# echo "eusb10"
# $(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify eusb10

@echo "rsfs10"
$(PYTHON) $(MFTRACE_MODIFIED) --magnification 1000 --simplify --encoding $(BASEENCODING)/tex256.enc rsfs10

mkdir -p pfa
rm -f pfa/*
mv *.pfa pfa
mv *.pfb pfa
# Create the pfb files
%.pfb: $(MFTRACE_MODIFIED)
cp "`$(KPSEWHICH) $@`" pfa/$@

ff: pfa
ff: $(PFA)
mkdir -p ff otf
rm -f ff/* otf/*
$(PERL) -I. makeFF
Expand Down