This file contains 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: which shortkeys are assigned to what action? | |
''' | |
import AppKit | |
import itertools | |
import mojo | |
import re | |
from pathlib import Path |
This file contains 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
''' | |
Avoid offcurve start points | |
''' | |
from fontTools.ufoLib.pointPen import PointToSegmentPen | |
def find_offcurve_start(glyph): | |
''' | |
compare coordinates of first bPoint to coordinates of first point |
This file contains 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
''' | |
toggle bcp selection | |
''' | |
def toggle_bcp_selection(bcp): | |
pts = bcp.contour.points | |
p_prev = pts[(bcp.index - 1) % len(pts)] | |
p_prev_2 = pts[(bcp.index - 2) % len(pts)] | |
p_next = pts[(bcp.index + 1) % len(pts)] |
This file contains 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 importlib import reload | |
import glyph_move_selection_forward | |
reload(glyph_move_selection_forward) | |
g = CurrentGlyph() | |
glyph_move_selection_forward.move_index(g, -1) |
This file contains 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 CurrentFontWindow | |
import AppKit | |
import unicodedata | |
from vanilla import CheckBox, FloatingWindow, List, LevelIndicatorListCell | |
import glyphNameFormatter | |
f = CurrentFont() | |
u_ranges = glyphNameFormatter.unicodeRangeNames.unicodeRangeNames | |
reverse_ranges = {v: k for k, v in u_ranges.items()} |
This file contains 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 AppKit | |
from mojo.roboFont import version | |
menu = AppKit.NSApp().mainMenu() | |
roboFontItem = menu.itemWithTitle_("RoboFont") | |
if roboFontItem: | |
# roboFontItem.submenu().setTitle_("RoboFont %s THIS IS THE OLD VERSION, WATCH OUT FRANK!" % version) | |
roboFontItem.submenu().setTitle_("RoboFont %s" % version) |
This file contains 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
''' | |
for https://github.com/adobe-fonts/source-code-pro/issues/247 | |
check character support requests against code points present in font | |
''' | |
import sys | |
import unicodedata | |
from fontTools import ttLib | |
This file contains 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
''' | |
Toggle the pair list of an open MetricsMachine (extension) window | |
from all kerning pairs (sorted by glyph order) to exceptions and back. | |
''' | |
import metricsMachine | |
import mm4 | |
f = CurrentFont() |
This file contains 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 out segment structure for current glyph in all open fonts. | |
If the structure matches, only one line will be printed: | |
a 0 ⤴️📈📈⤴️⤴️⤴️⤴️📈⤴️⤴️⤴️ 1 ⤴️📈⤴️⤴️📈⤴️⤴️⤴️⤴️📈📈⤴️⤴️📈📈⤴️ ✔ | |
If it does not, the structure of all open fonts will be printed for comparison: |
This file contains 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 math | |
def calc_vector(p1, p2): | |
x1, y1 = p1 | |
x2, y2 = p2 | |
return x2 - x1, y2 - y1 | |
def calc_distance(p1, p2): |
NewerOlder