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
| #!/usr/bin/env python | |
| """Find masters with duplicate Link Metrics With Master parameters.""" | |
| import sys | |
| from glyphsLib import GSFont | |
| font = GSFont(sys.argv[1]) | |
| duplicates_found = 0 | |
| for master in font.masters: |
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
| import sys | |
| from fontTools.pens.basePen import NullPen | |
| from fontTools.ttLib import TTFont | |
| if len(sys.argv) < 3: | |
| print("usage: draw_glyph_advance.py fontfile.ttf glyphname [tag=value ...]") | |
| sys.exit(1) | |
| input_file, glyph_name = sys.argv[1:3] | |
| print(f"glyph: {glyph_name}") |
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
| """ | |
| Usage: | |
| python add_ot_feature.py Sulekha.ttf Sulekha_new.ttf | |
| """ | |
| import sys | |
| from fontTools.ttLib import TTFont | |
| from fontTools.feaLib.builder import addOpenTypeFeaturesFromString |
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
| """Use FontTools subsetter's prune_lookup method to remove all unreferenced lookups from GPOS and GSUB tables.""" | |
| import sys | |
| from fontTools.misc.cliTools import makeOutputFileName | |
| from fontTools.ttLib import TTFont | |
| # importing this dynamically adds a prune_lookups method to GPOS/GSUB classes | |
| from fontTools import subset | |
| input_file = sys.argv[1] |
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
| from ufo2ft.featureWriters.markFeatureWriter import MarkFeatureWriter | |
| from fontTools.feaLib.ast import FeatureFile | |
| from ufoLib2 import Font | |
| fea = FeatureFile() | |
| font = Font() | |
| a = font.newGlyph("a") | |
| a.appendAnchor({"name": "top", "x": 500, "y": 600}) |
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
| import sys | |
| import argparse | |
| import logging | |
| from fontTools.ttLib import TTFont | |
| from fontTools.ttLib.tables._f_v_a_r import Axis | |
| from fontTools.varLib.builder import buildVarRegionAxis | |
| log = logging.getLogger("add_fvar_axis.py") |
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
| """ | |
| The contours from https://gist.github.com/rsheeter/cef6cf71fa9e519c94f9f0d23906e5de are in fact not compatible | |
| and this even before we attempt to reverse them. | |
| See https://github.com/fonttools/fonttools/issues/3093 | |
| """ | |
| from ufoLib2 import Font | |
| from ufo2ft import compileInterpolatableTTFs | |
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
| """Print all the glyph 'master' locations from a variable TTF (user-scale coordinates). | |
| A 'master' along a given axis is where a delta-set region peaks. | |
| """ | |
| from fontTools.varLib.models import piecewiseLinearMap | |
| def map_axis_values(axis_mappings, location): | |
| return { |
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
| import logging | |
| import shutil | |
| import os | |
| from fontTools.misc.loggingTools import Timer | |
| import orjson | |
| from ufoLib2.converters import json_converter as c | |
| from ufoLib2.objects import Font |
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
| """ | |
| Similar to pip freeze, but only listing the installed dependencies for the selected package. | |
| E.g.: | |
| $ python freeze_requirements.py fonttools[ufo] | |
| # Installed requirements for 'fonttools[ufo]' (5 in total): | |
| appdirs==1.4.4 | |
| fonttools==4.24.4 | |
| fs==2.4.13 |
NewerOlder