Skip to content

Instantly share code, notes, and snippets.

@Wybxc
Created January 7, 2026 09:34
Show Gist options
  • Select an option

  • Save Wybxc/dc8721bba889ea15e4c7e6b3eed43ffd to your computer and use it in GitHub Desktop.

Select an option

Save Wybxc/dc8721bba889ea15e4c7e6b3eed43ffd to your computer and use it in GitHub Desktop.
Convert MLModern from Type 1 format to WOFF2 (with ligatures!)
# This script is derived from https://gist.github.com/nanxstats/1f767cb964dda645a90f84cbade05dcb#file-mlmodern-otf-woff2-sh
curl -L http://mirrors.ctan.org/fonts/mlmodern.zip > mlmodern.zip
unzip -o mlmodern.zip
cd mlmodern/type1/
cat > liga.fea << 'EOF'
languagesystem DFLT dflt;
languagesystem latn dflt;
feature liga {
# Latin ligatures
sub f f by ff;
sub f i by fi;
sub f l by fl;
sub f f i by ffi;
sub f f l by ffl;
} liga;
EOF
fontforge -lang=ff -c 'Open($1); Generate($1:r + ".otf")' mlmr12.pfb
fontforge -lang=ff -c 'Open($1); Generate($1:r + ".otf")' mlmri12.pfb
fontforge -lang=ff -c 'Open($1); Generate($1:r + ".otf")' mlmbx12.pfb
uvx --from afdko makeotf -f mlmr12.otf -ff liga.fea -o mlmr12_ligafix.otf
uvx --from afdko makeotf -f mlmri12.otf -ff liga.fea -o mlmri12_ligafix.otf
uvx --from afdko makeotf -f mlmbx12.otf -ff liga.fea -o mlmbx12_ligafix.otf
woff2_compress mlmr12_ligafix.otf
woff2_compress mlmri12_ligafix.otf
woff2_compress mlmbx12_ligafix.otf
mv mlmr12_ligafix.woff2 mlmodern-regular.woff2
mv mlmri12_ligafix.woff2 mlmodern-italic.woff2
mv mlmbx12_ligafix.woff2 mlmodern-bold.woff2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment