Commit Graph

31 Commits

Author SHA1 Message Date
Rebecca Kelly
bfa324d3c7 Update comments at the start of ligaturize.py 2021-09-04 10:22:14 -04:00
Rebecca Kelly
897124643d Don't crash if the font has no embedded copyright (e.g. mononoki)
Fixes #92
2021-09-04 08:53:07 -04:00
B. Kelly
eaca739bd4 Update 'Family' SFNT entry.
Thanks to @sirgu for the fix.

Fixes #75
2020-03-13 18:15:09 -04:00
Gary Lo
3d75e1bb9e fix #73 ord() expected a character. 2020-01-31 15:22:21 +08:00
Navid Rojiani
daa4dc8baf Use Python 3
The scripts work with Python 3 now (with a few changes).
Remove Python 2 requirement.
2019-10-09 17:27:26 -04:00
Farid A
a95b6fbf96 Font naming corrections: suffix recognition and WWS Family 2019-07-29 23:56:30 -04:00
Ben Kelly
6d3070ae1c Fix 'Preferred Family' and 'Compatible Full' SFNT entries.
This should fix the issues with Ligalex and Ubuntu Mono Ligaturized colliding
with the original fonts in some font selectors.
2019-02-13 10:27:09 -05:00
Justin Su
ff89b86078 Generate font type corresponding to input font 2018-12-23 06:43:11 -05:00
Ben Kelly
5389c7c2b3 Remove output-fonts in favour of releases
Ligaturized fonts are no longer checked in; instead they're zipped and
put under releases.
2018-08-31 20:15:47 -04:00
Ben Kelly
981063392d Remove google fonts submodule; add IBM Plex and Codeface submodules
It turns out that every font we want is in Codeface except for Plex,
which
has its own git repo. So now all of our source fonts are submodulized!
2018-08-31 19:40:14 -04:00
Ben Kelly
01b7c2bb01 Completely rework build process, and rename files for license compliance
This addresses #25 and (partially) #42; fonts that we can't make derivative
works of are no longer checked in, and fonts that need to be renamed for
license compliance have been.

The build process is also now a bit more robust.
2018-08-31 14:47:53 -04:00
Justin Su
a9e24954a9 Move fira to submodule 2018-08-31 10:27:50 -04:00
Ben Kelly
107a135207 Die explicitly if running on python != 2
This should hopefully cut down on bug reports from people stuck with a
Fontforge install that's linked against Python 3, which doesn't work,
c.f. #6.
2018-08-27 18:54:22 -04:00
Ben Kelly
8533408f7a Add --prefix option and update font metadata based on that
Rather than trying to infer the font name and weight from the filename,
ligaturizer now uses the metadata embedded in the font file and sticks
the desired prefix onto it.
2018-04-22 21:15:25 -04:00
Ben Kelly
f98f3523bb Lookup letter glyphs by codepoint rather than name
Fonts usually let you look up the glyphs by name, but not always; all
they are *required* to support is lookup by codepoint. This fixes em
lookup and the www ligature on fonts that don't have nametables for
letter glyphs.

Fixes #16 and #21.
2018-03-06 21:14:35 -05:00
Ben Kelly
b5664a696b First pass at correcting ligature width
This scales all copied ligatures based on the ratio between the
ligature's horizontal advance and the target font's em width, then
corrects the horizontal advance.
2018-01-27 14:26:01 -05:00
Ben Kelly
434f729f15 Width-correct individual characters when copying them
Fira Code punctuation characters (a) vary in horizontal advance among
themselves and (b) may not match the horizontal advance or glyph width
of the target font. This change fixes the horizontal advance when
copying individual characters.

Depending on the width of the copied characters (relative to the input
font) and the setting of --scale-character-glyphs-threshold, it will
also either scale the copied glyphs horizontally, or simply center them
inside the now correctly sized hbox.

Note that this only applies to individual characters (and thus is a
no-op if the user hasn't turned on individual character copy with the
--copy-character-glyphs option); properly scaling ligatures is still a
work in progress.
2018-01-27 14:26:01 -05:00
Ben Kelly
ce11b2e92f Add --copy-character-glyphs option
Whether character glyphs are copied is now controlled by the command
line options rather than by `ligatures.py`.
2018-01-27 14:26:01 -05:00
Ben Kelly
ba71329c48 Switch to argparse for argument handling 2018-01-27 14:26:01 -05:00
Ben Kelly
516aa3401b Turn off a spammy error message. 2018-01-27 14:20:35 -05:00
Ben Kelly
1ea777f847 Work around Fontforge underline position bug.
Specifically, when you call generate(), it helpfully adjusts the underline
position by subtracting the underline line width. This means the underline
position for the generated font is lower than the underline position in the
original font, potentially low enough to push it into the next line of text.
This causes weird rendering glitches in (at least) Konsole when displaying
underlined text.
2018-01-22 20:18:44 -05:00
Ben Kelly
e7856e2027 Generate output fonts in-place.
If fontforge crashes or is otherwise interrupted, you can just regenerate
the font; I think the risk of leaving a half-generated font file around is
less than the risk of unexpectedly overwriting something in the current
working directory, which is what the previous behaviour did.
2018-01-22 20:15:28 -05:00
Ben Kelly
9df424631a Generate ignore sub tables to constrain ligature conversion.
This matches the behaviour of Fira Code, where long runs of identical
characters don't get ligaturized; for example, with this change,
`######` will get ligaturized as six `#` characters, rather than as
three `##` characters.
2018-01-19 20:15:04 -05:00
Ben Kelly
768ba112ff Add support for copying individual characters as well 2018-01-19 20:12:09 -05:00
Ben Kelly
2c7bb65892 Infer ligature font weight from output name; update FiraCode fonts
This updates the FiraCode OTFs to version 1.204, and makes ligaturize.py
infer which one to use based on the name of the output file; e.g. if you
name your output `Ligaturized-Bold` or `Ligaturized-BoldItalic`, it will
use `FiraCode-Bold.otf` as the ligature source.

It also lets the user explicitly specify the ligature source as a third
command line argument if the inference is wrong (which opens the door to
using non-Fira Code ligatures, too).
2018-01-19 19:56:24 -05:00
Ben Kelly
ff7bc13d27 Skip ligatures missing from the FiraCode OTF
This lets the user use different versions of the OTF without the wheels
coming off.
2018-01-19 19:56:24 -05:00
Ben Kelly
55ca80572d Infer font family and weight from output filename
In particular, this means you can generate (e.g.)
'CousineLigatures-Regular.ttf' and 'CousineLigatures-Bold.ttf', and they
will both be in the font family 'Cousine Ligatures'.
2018-01-19 19:56:16 -05:00
Ben Kelly
833174fdc5 Get input and output fonts from argv 2018-01-19 19:54:22 -05:00
Ben Kelly
c1a220e44a Pull ligature list into a separate file for easier updates 2018-01-19 19:48:48 -05:00
Navid Rojiani
885b5835a2 Renamed input/output directories
Also cleaned up README.
2017-10-03 21:04:20 -07:00
Navid Rojiani
0ef47a320f Initial commit
Add script, README, source & ligaturized fonts
2017-08-07 22:21:10 -07:00