Skip to content

Instantly share code, notes, and snippets.

View mathieureguer's full-sized avatar

Mathieu Réguer mathieureguer

View GitHub Profile
import os.path
# get a path for a png file next to the ufo
path_base = os.path.splitext(CurrentFont().path)[0]
path path_base + ".png"
@mathieureguer
mathieureguer / takeScreenshotAndSaveIt.py
Last active June 15, 2017 20:42 — forked from typemytype/takeScreenshotAndSaveIt.py.py
take screenshot and save it
import Quartz
import AppKit
import os.path
from mojo.UI import CurrentSpaceCenterWindow
# get a path for a png file next to the ufo
path_base = os.path.splitext(CurrentFont().path)[0]
path = path_base + ".png"
@mathieureguer
mathieureguer / SortExtentionMenu_HighSierraHotFix.py
Last active March 9, 2018 14:26
Just a little hack to fix the Extension menu sorting in Robofont 1.8 + High Sierra
# fix the Extentions menu sorting in macOS High Sierra in Robofont 1.8
# (set this up as a start up script and you're good to go)
# This is just a hack, you should really check out RoboFont 3
from AppKit import *
from lib.doodleMenus import BaseMenu
# ----------------------------------------
# HI DAVE!
import math
canvas = 500
squareSize = 100
startPos = 0
endPos = 400
@mathieureguer
mathieureguer / AssignGlyphSet.py
Created February 13, 2019 12:34
A glyph set picker for Robofont 3
# menuTitle: Assign Glyph Set
# Mathieu Reguer
"""
version 0.4
- switched to vanilla.dialogs.getFile
version 0.3
- Added import charset option
"""
Open a bunch of ufos, select a bunch of interestng glyphs in a font window and run this.
As a nice bonus, this is also a way to reduce the scope of the the next and previous glyph hotkeys.
"""
from mojo.UI import SmartSet, AllFontWindows
f = CurrentFont()
for w in AllFontWindows():
"""
selectively copy and paste glyph attributes
"""
from vanilla import *
class attributeMover():
def __init__(self):
#menuTitle: ReMutate Support Layer
import ufoProcessor
import mojo.UI
import pathlib
# ----------------------------------------
def get_sources_paths(designspace):
# 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
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 :)