This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A script to run on UFO files from a command line. Go through a pair list and | |
copy kerns from one UFO to one other UFO, if those kern pairs are in the pair list. | |
What happens: | |
- copy groups from ufoToCopyFrom to ufoToCopyTo | |
- for each pair in the pair list, copy kern from ufoToCopyFrom to ufoToCopyTo | |
Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A script to make all glyphs in a TTF blank, while leaving metrics, features, etc in place. | |
""" | |
from fontTools import ttLib | |
from fontTools.ttLib.tables._g_l_y_f import Glyph | |
from argparse import ArgumentParser | |
def eraseGlyphs(fontPath, inplace=False): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Split glyphs from a given kerning group, but keep kerning | |
so you don’t lose a bunch of almost-correct kerns. | |
(Slightly | |
E.g. If you need to split "e" glyphs out of the "o" group. | |
USAGE: | |
- set originalGroupName (group to split from) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
⚠️⚠️⚠️ | |
OOPS. Don’t use this. FontParts already has BaseGlyph.correctDirection() | |
⚠️⚠️⚠️ | |
Go through UFOs in directory and orient contour paths in a counter-clockwise direction, | |
as they should be for cubic/postscript/CFF/"OTF" curves. | |
DEPENDENCIES: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Here’s a snippet to determine how much horizontal shift a point should get in an italic glyph. | |
In practical terms, I have just used this to shift anchors in a UFO font source, in order to prepare an oblique font. | |
Basically, how can we determine "x" below, given a height ("y") and an angle (italicAngle)? | |
x | |
• - - • | |
| / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Removes currently selected glyphs from current font. | |
Also removes these glyphs from groups, kerning, and components. | |
Includes template glyphs in selection and removal. | |
""" | |
f = CurrentFont() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Find kerning exceptions in a UFO, then remove those kerns and replace them with kerns using groups. | |
Why? | |
Sometimes, if you add kerning to a font early, you can wind up with unexpected kerning exceptions | |
when you add new characters to the font. E.g. ('G', 'asterisk') makes sense until you add 'Gbreve'. | |
USAGE: | |
Configure side1_ignore & side2_ignore lists below, then run this script in RoboFont. | |
- It won’t autosave your UFOs, because you should probably review the results before saving. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple way to compare the unicodes currently covered by a font binary to GF Glyph Sets. | |
Doesn’t account for glyphs that don’t have unicodes, such as most ligatures, case-specific puncutation, etc. | |
Glyph Sets copied and adjusted from: | |
https://github.com/googlefonts/gftools/tree/3aefd92ba3f9ab5355de472a4cb1e4b19c1a3b2e/Lib/gftools/encodings/GF%20Glyph%20Sets#google-fonts-2016-glyph-sets | |
Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python3 src/build-scripts/helpers/add-STAT-display_only.py <build_directory> | |
...where <build_directory> is a folder containing two variable fonts, e.g. Family-Variable.ttf and FamilyItalic-Variable.ttf | |
This file is adapted from an example originally in https://github.com/Omnibus-Type/Texturina | |
""" | |
from fontTools.otlLib.builder import buildStatTable, _addName | |
from fontTools.ttLib import TTFont |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A RoboFont script to print all characters in a font that have a unicode value. | |
""" | |
f = CurrentFont() | |
unicodes = [] | |
for name in f.keys(): | |
if f[name].unicodes != () and f[name].width != 0: |