import unittest
class TestAModule(unittest.TestCase):
def setUp(self):
# create test data
pass
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.ttLib import TTFont | |
import argparse | |
import os | |
import sys | |
""" | |
Transfer glyphs from one set of fonts from soucre dir to target dir. | |
The file names should match and fonts should be ttf. This script does | |
not transfer kerning, marks or substitutions in the features. Usage: | |
python append_glyphs.py -h | |
""" |
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.feaLib.ast import IncludeStatement | |
from fontTools.feaLib.parser import Parser | |
from io import StringIO | |
import os | |
from pathlib import PurePath | |
""" | |
Get paths of included feature files in a ufo file. | |
This script makes an assumption feature are written inside the `ufo.features.text`. | |
Features could be written inside another file that could exist next to the UFO | |
package (instead of inside the UFO package). This script doesn't support that yet. |
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.feaLib.parser import Parser | |
from fontTools.feaLib.ast import * | |
from io import StringIO | |
""" | |
RoboFont Script | |
- Type: Mastering | |
- Purpose: To find ligature by parsing the features. | |
- Specifications: | |
- Parse the substitutions in the current font features using fontTools.feaLib | |
- Find lookup references in the provided feature tags |
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 fontParts.fontshell.font import RFont | |
from fontTools.pens.cocoaPen import CocoaPen | |
f = RFont("expand-stroke.ufo") # a ufo with one line path for a glyph (no closed contours) | |
canvasSize = 800 | |
numFrames = 200 | |
def getGlyphPath(glyph): | |
pen = CocoaPen(glyph.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
""" | |
RoboFont Script | |
- Type: UI/start up | |
- Purpose: Runs on RF start up and adds a function to mojo.UI module: | |
CurrentSelection() which returns the selected RGlyph object(s) | |
based on what window is active. | |
- Specifications: | |
- Find which window is active using mojo.UI.CurrentWindow then return the Glyph(s) | |
- Publish Date: 20 April 2020 | |
- Author: Bahman Eslami |
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 glyphConstruction import * | |
from mojo.UI import CurrentWindow | |
""" | |
RoboFont Script | |
- Type: Metrics | |
- Purpose: Fix metrics of selected glyphs according to a formula. | |
- Specifications: | |
- Uses RoboFont GlyphConstruction syntax to change metrics of glyphs. | |
- Publish Date: 18 April 2021 |
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 simpleKerning import * | |
""" | |
A RoboFont script to expand kerning groups from base glyph to their composites. | |
1. Select the composites which are not grouped | |
2. Run the script | |
3. The groups will be expanded to the composites, if: | |
- Their width is same as the base glyph | |
- They're not already grouped | |
""" |
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
""" | |
You can use this to get the window name if it has become the key window in | |
RoboFont. But the same data model can be used to create notifications inside | |
objc apps. | |
""" | |
from objc import python_method | |
import AppKit | |
from vanilla import FloatingWindow | |
from lib.tools.debugTools import ClassNameIncrementer |
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 ctypes | |
import ctypes.util | |
import objc | |
import CoreFoundation | |
""" | |
Find currently availabe keyboard layout input sources in Mac OSX using pyobjc. Based on: | |
https://gist.github.com/tiann/f85e89bef4b6e9b83f2a | |
""" |