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
# brings macro window to front and clears its log: | |
Glyphs.clearLog() | |
Glyphs.showMacroWindow() | |
from math import sqrt, acos, degrees | |
def dot_product(v1, v2): | |
return v1[0] * v2[0] + v1[1] * v2[1] | |
def magnitude(v): |
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
MacroTab.title = "Check ()[]{}" | |
Glyphs.clearLog() | |
Glyphs.showMacroWindow() | |
# adapt as needed: | |
threshold = 1.0 | |
font = Glyphs.font | |
print(font.familyName) |
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
MacroTab.title = "Check small figures" | |
Glyphs.clearLog() | |
Glyphs.showMacroWindow() | |
# please adapt as needed (Glyphs defaults as comments): | |
defaultExtension = ".denominator" # ".dnom" | |
extensions = ( | |
".numerator", # ".numr" | |
"superscript", # "superior" |
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
MacroTab.title = "Align ĦŁł..." | |
glyphsToAlign = ( | |
"Hbar", | |
"Lslash", | |
"lslash", | |
# add more glyph names here | |
) | |
Glyphs.clearLog() | |
Glyphs.showMacroWindow() |
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
MacroTab.title = "Fix ()[]{}" | |
Glyphs.clearLog() | |
Glyphs.showMacroWindow() | |
font = Glyphs.font | |
print(font.familyName) | |
collectedLayers = [] | |
threshold = 1.0 | |
for m in font.masters: | |
mid = m.id | |
for bracket in ("paren", "bracket", "brace"): |
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
m = Font.selectedFontMaster | |
for sl in Font.selectedLayers: | |
g = sl.parent | |
print "Processing %s:" % g.name, | |
targetLayer = g.layers[m.id] | |
pathcount = 0 | |
for l in g.layers: | |
if l.isMasterLayer and l != targetLayer: | |
for p in l.paths: | |
targetLayer.paths.append(p.copy()) |
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
#MenuTitle: Report Area in Square Units | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Calculates the area of each selected glyph, and outputs it in square units. Increase precision by changing the value for PRECISION in line 9 (script will slow down). | |
""" | |
PRECISION = 2 # higher numbers = more precision, but slower |
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
#MenuTitle: Compare Font Spacings | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Compare spacing of open fonts, output in the Macro Window. | |
""" | |
abc = "abcdefghijklmnopqrstuvwxyz" | |
frequencies = { # Source: Wikipedia |
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
#MenuTitle: Steal Colors from Font | |
"""Copy glyph colors from one font to another.""" | |
import vanilla | |
class GroupsCopy(object): | |
"""GUI for copying colors from one font to another""" | |
def __init__(self): | |
self.w = vanilla.FloatingWindow((400, 70), "Steal colors") | |
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
#MenuTitle: Extract kern strings (1st character) | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
Analyze a textfile: look for certain characters and output all letter combinations occurring in the text file to the Macro Window. | |
""" | |
import vanilla | |
from PyObjCTools.AppHelper import callAfter |
NewerOlder