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, registerCurrentFontSubscriber, unregisterRoboFontSubscriber, unregisterCurrentFontSubscriber | |
import AppKit | |
class BASE: | |
def update_tabs(self, font): | |
if font: | |
has_values = True | |
for val in "familyName styleName".split(" "): | |
if not hasattr(font.info, val): | |
has_values = False |
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 sublime | |
import sublime_plugin | |
import os | |
import tempfile | |
from fontTools import ttx | |
PREFIX = ".st3_ttx." | |
SFNT_SUFFIXES = ".otf .ttf .woff .woff2".split(" ") | |
class OpenTTX(sublime_plugin.EventListener): |
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 more_itertools | |
def _as_list(item): | |
return list(more_itertools.always_iterable(item)) | |
def _get_designspaces(self) -> list[str]: | |
return _as_list(self.lib.get('public.designspaces', [])) | |
def _set_designspaces(self, new_designspace:str | list[str]): | |
self.lib['public.designspaces'] = _as_list(new_designspaces) |
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, registerGlyphEditorSubscriber, unregisterGlyphEditorSubscriber, listRegisteredSubscribers | |
from mojo.UI import inDarkMode | |
class anchor_scrubber(Subscriber): | |
debug = False | |
def build(self): | |
editor = self.getGlyphEditor() |
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 | |
from mojo.UI import GlyphRecord | |
class space_center_alts_manager(Subscriber): | |
def started(self): | |
self.glyph = None | |
self.alternates = [] | |
self.space_center = None |
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 touche import Touche | |
# uses Ondrej Jób's source data from Context of Diacritics via Setup Type | |
# and Nina Stössinger's Touche to check touching pairs in the current font. | |
# https://www.setuptype.com/x/cod/source/lists | |
real_world_pairs = ''' | |
a aacute | |
a adieresis | |
a agrave |
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 math | |
from mojo.events import postEvent | |
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber, unregisterGlyphEditorSubscriber, listRegisteredSubscribers | |
from lib.tools.defaults import getDefault | |
from fontTools.misc import transform | |
border = getDefault("glyphViewVerticalPadding") | |
fontsize = getDefault("textFontSize") | |
metricsStroke = getDefault("glyphViewFontMetricsStrokeColor") |
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 | |
def _setExport(self, export): | |
skipExportGlyphs = set(self.font.lib.get("public.skipExportGlyphs", [])) | |
if export == False: | |
skipExportGlyphs.add(self.name) | |
elif export == True: | |
if self.name in skipExportGlyphs: | |
skipExportGlyphs.remove(self.name) | |
else: |
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, unregisterRoboFontSubscriber | |
from mojo.UI import getDefault | |
from AppKit import NSMenuItem | |
from mojo.tools import CallbackWrapper | |
import ezui | |
class set_contextual_mark_colors(Subscriber): | |
debug = 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
''' | |
Custom RGlyph `bounds` property that takes anchors into account | |
''' | |
@property | |
def full_bounds(self): | |
bounds = list(self.bounds) | |
for anchor in self.anchors: | |
if anchor.x < bounds[0]: | |
bounds[0] = anchor.x | |
if anchor.x > bounds[2]: |
NewerOlder