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 Subscriber, registerRoboFontSubscriber | |
class LayerSinker(Subscriber): | |
def fontDocumentDidOpen(self,info): | |
font = info["font"] | |
font.lib['com.typemytype.robofont.syncGlyphLayers'] = 'metrics' | |
registerRoboFontSubscriber(LayerSinker) |
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.roboFont import RGlyph | |
from mojo.UI import getDefault | |
''' | |
g = CurrentGlyph() | |
g.markColorName = "Red" | |
''' | |
def _setColorName(self, color=None): | |
if not isinstance(color, str): |
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 AppKit import NSBeep,NSTimer,NSRunLoop,NSRunLoopCommonModes | |
import git | |
import os | |
from mojo.extensions import setExtensionDefault, getExtensionDefault | |
import re | |
from mojo.UI import PostBannerNotification | |
''' | |
A startup script for RoboFont to automatically commit to Git every 5 minutes. | |
To use, run the following script with your GitHub email: |
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
''' | |
fontParts add-on to get specific locations of a glyph's bounds | |
10 | |
0 3 6 | |
####### | |
# # | |
# # | |
9 1 ## 4 ## 7 |
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 Subscriber, registerRoboFontSubscriber | |
import AppKit | |
class MargielaTabs(Subscriber): | |
def fontDocumentDidOpen(self,info): | |
newFont = info["lowLevelEvents"][0]["font"] | |
windowsMap = {} | |
allFonts = {f.info.familyName:AllFonts().getFontsByFamilyName(f.info.familyName) for f in AllFonts()} | |
for familyName,fonts in allFonts.items(): |
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 CurrentSpaceCenter | |
def measureLine(pointSize, records): | |
scale = pointSize / window.font.info.unitsPerEm | |
sublists = [] | |
currentSublist = [] | |
lineBreakChar = "NewLineGlyph" | |
for item in records: | |
if item.glyph.objectName == lineBreakChar: |
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 Subscriber, registerCurrentFontSubscriber | |
import unicodedata | |
class AutoNameSetter(Subscriber): | |
debug = True | |
def build(self): | |
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.designspaceLib import DesignSpaceDocument, InstanceDescriptor | |
from ufoProcessor import DesignSpaceProcessor, ufoOperator | |
import tempfile | |
import os | |
import shutil | |
from mojo.UI import GetFile | |
f = CurrentFont() | |
file = f.lib.get("com.connordavenport.interpolateSupport.designspaceFile") | |
if file: |
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.designspaceLib import DesignSpaceDocument, InstanceDescriptor | |
from ufoProcessor import DesignSpaceProcessor, ufoOperator | |
import tempfile | |
import os | |
import shutil | |
dsPath = 'path/to/file.designspace' | |
for f in AllFonts(): | |
for l in f.layers: | |
for g in l: |
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 Subscriber, registerRoboFontSubscriber | |
class makeParts(Subscriber): | |
debug = True | |
def glyphEditorWantsContextualMenuItems(self, info): | |
myMenuItems = [ | |
("Make Component of Contour(s)", self.markPartCallback), |