Commit Graph

15 Commits

Author SHA1 Message Date
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