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
""" | |
This is very barebones, but it allows changing one or several locations | |
within a designspace while preerving an identical output. | |
(hey, it's hard to plan a designspace exactly right from the start :) | |
ie. changing a source location from weight:1200 to weight:1000 will recalculate all the other locations | |
so that the resulting instances remain the same as before. | |
Set your relocation_map below. | |
""" |
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
#menuTitle: flag USWin table cropped glyphs | |
for font in AllFonts(): | |
y_min_flags = [] | |
y_max_flags = [] | |
for g in font: | |
if g.bounds: | |
_, _, y_min, y_max = g.bounds |
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
""" | |
Run in Robofont. | |
Tries to add anchors to selected glyphs, based on the position of components in relevant glyphs. | |
This script is not smart enough to distinguish top and bottom anchors (sorry), it must be run again for each target_anchor_name. | |
Here is a typical process: | |
- add "_top" to the circumflex glyph (we need at least an anchor as a starting point) | |
- set target_anchor_name to "top" | |
- select the base glyphs you want anchored (both base letters and diacritic glyphs) | |
- run |
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
IGNORE_ANCHORS = [] | |
# ---------------------------------------- | |
def match_anchor(anchor_source, anchor_targets): | |
if anchor_source.name.startswith("_"): | |
target_name = anchor_source.name[1:] | |
else: | |
target_name = "_" + anchor_source.name | |
for a in anchor_targets: |
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
# this is largely stolen from Antonio Cavedoni's much cooler CAShapeLayer animation demo. | |
import vanilla | |
from mojo.events import addObserver, removeObserver | |
from mojo.UI import splitText | |
from fontTools.pens.basePen import BasePen | |
from AppKit import NSView, NSMakeRect, NSColor, CAShapeLayer, NSRect, CAScrollLayer | |
from Quartz.QuartzCore import kCALayerWidthSizable, kCALayerHeightSizable, CABasicAnimation |
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 mojo.subscriber import * | |
def toggleSubscriberClass(SubscriberClass, register_function): | |
""" | |
Will register a SubscriberClass with the suplied register_function if that SubscriberClass is not already registered. | |
Will unregister a SubscriberClass with the corresponding unregister_function if that SubscriberClass is already registered. | |
Usage: | |
considering the Neighbours.py example in the Robofont documentation |
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 mojo.UI import SetCurrentLayerByName | |
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber | |
from fontTools.ufoLib.pointPen import AbstractPointPen | |
import math | |
""" | |
This is *largely* based on the great work of Jackson Cavanaugh on AddOverlapp | |
and the awesome drag offset update by Ryan Bugden | |
It is *extremly* likely not the best way to use merz and subscriber :) |
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
# menuTitle : auto align points | |
# shortCut : command+shift+E | |
""" | |
Move 2 points to align them. | |
Will guess between x and y alignment based on shortest move required. | |
Should align according to italic angle as well. | |
""" | |
do_italic_angle = True |
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
#menuTitle: ReMutate Support Layer | |
import ufoProcessor | |
import mojo.UI | |
import pathlib | |
# ---------------------------------------- | |
def get_sources_paths(designspace): |
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
""" | |
selectively copy and paste glyph attributes | |
""" | |
from vanilla import * | |
class attributeMover(): | |
def __init__(self): |
NewerOlder