Skip to content

Instantly share code, notes, and snippets.

View typesupply's full-sized avatar

Tal Leming typesupply

View GitHub Profile
from fontTools.pens.pointPen import (
AbstractPointPen,
GuessSmoothPointPen
)
from fontParts.base.bPoint import (
relativeBCPIn,
absoluteBCPIn,
relativeBCPOut,
absoluteBCPOut
)

EZML Syntax Basics

# comment
whitespace has no meaning except single spaces used to separate important things
@ is an identifier
() means button of some sort
[__] means text entry of some sort (except checkbox)
{} means image
- means line

Intro Session

Why does ezui exist?

We've learned a lot.

We have been making type design tool UIs for over 25 years. We have a lot of experience and examples to learn from. Our API for building UI hasn't changed much in 25 years. (We're still using the W API from RoboFont.) It works, but can we have something better?

Break it into a design problem...

@typesupply
typesupply / merzHitTestTest.py
Last active September 21, 2023 16:20
Test Merz hit testing with a glyph editor.
from mojo.events import BaseEventTool, installTool
backgroundColor = (1, 1, 0, 0.5)
mouseDownColor = (0, 0, 0, 0.25)
defaultSymbolSettings = dict(
name="oval",
size=(20, 20),
fillColor=(1, 0, 0, 0.75),
strokeColor=(1, 1, 1, 0.5),
strokeWidth=10
@typesupply
typesupply / Smooth Bot.py
Created May 18, 2022 14:21
Bot that automatically fixes the smooth setting when it isn't correct.
from fontPens.guessSmoothPointPen import GuessSmoothPointPen
from fontParts.world import RGlyph
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber, disableSubscriberEvents
class SmoothBot(Subscriber):
debug = False
def glyphEditorGlyphDidChangeContours(self, info):
glyph = info["glyph"]
@typesupply
typesupply / Tabular Figures.py
Created May 10, 2022 19:45
Start tabular figures.
"""Create tabular figures. Version 0.1"""
"""
This script gives you a UI and some options for building tabular
figures. The generated glyphs contain duplicates of the source
glyphs, but their widths and sidebearings have been changed.
This does not attempt to squeeze or stretch the outlines, rather
it simply shifts them around.
-----------------------------------------------------------------
@typesupply
typesupply / Auto Denominators.py
Last active June 19, 2022 21:57
Auto Denominators
font = CurrentFont()
figures = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
bottom1 = font["one"].bounds[1]
bottom2 = font["one.num"].bounds[1]
shift = bottom1 - bottom2
isItalic = font.info.italicAngle != 0
@typesupply
typesupply / vanilla.py
Created April 13, 2021 12:49
vanilla.py version 0.0000000000000000000000000000000001, March 25, 2005 2:35 AM
"""
To do:
- auto alignment bugs?
- get rid of the frigging background override in List. UGH!
- implement all Window methods from W
- add all (or at least all feasable) init methods form W
- lots of other stuff.
- zzzzzzzzzzzz.
"""
from urllib.request import build_opener
import bs4
from nltk.tokenize import PunktSentenceTokenizer
# Pull some text from a Wikipedia entry.
# The text could also come from a string, file or whatever.
url = "https://en.wikipedia.org/wiki/Font,_Switzerland"
opener = build_opener()
from mojo import events
import metricsMachine
class MMCurrentPairObserver(object):
def __init__(self):
self.previousPair = None
events.addObserver(
self,
"currentPairChangedCallback",