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 |
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 python3 | |
| # Copyright 2020 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
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 python3 | |
| # Example script to remove overlaps in TTF using skia-pathops | |
| import sys | |
| from fontTools.ttLib import TTFont | |
| from fontTools.pens.recordingPen import DecomposingRecordingPen | |
| from fontTools.pens.ttGlyphPen import TTGlyphPen |
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 glob | |
| from lxml import etree | |
| svg_directory = sys.argv[1] | |
| noid_files = set() | |
| id_files = set() | |
| for filename in glob.glob(f"{svg_directory}/*.svg"): | |
| tree = etree.parse(filename) |
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
| # Copyright 2020 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
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 os | |
| import sys | |
| __requires__ = ["pdfminer.six"] | |
| from pdfminer.psparser import LIT | |
| from pdfminer.pdfparser import PDFParser | |
| from pdfminer.pdfdocument import PDFDocument | |
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 fontTools import designspaceLib | |
| import os.path | |
| # define axes names, tags and min/default/max | |
| AXES = [ | |
| dict(name="Weight", tag="wght", minimum=400, default=400, maximum=700), | |
| dict(name="Width", tag="wdth", minimum=50, default=100, maximum=100), | |
| ] |
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 fontTools import designspaceLib | |
| import ufo2ft | |
| import ufoLib2 | |
| UPEM = 1000 | |
| WIDTH = UPEM // 2 | |
| FAMILY_NAME = "MyAwesomeVariableFont" | |
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 ufo2ft.constants import * | |
| from ufoLib2 import Font | |
| UPEM = 1000 | |
| WIDTH = UPEM // 2 | |
| def _layer(font, name): | |
| try: |
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 glyphsLib import GSFont | |
| # 'offcurve' GSNode.type is equivalent to 'None' in UFO PointPen API | |
| _UFO_NODE_TYPES = {"line", "curve", "qcurve"} | |
| def drawGSLayerWithPointPen(layer, pointPen): | |
| """ Draw a Glyphs layer with a FontTools PointPen. |