Skip to content

Instantly share code, notes, and snippets.

View arialcrime's full-sized avatar

Benedikt Bramböck arialcrime

View GitHub Profile
@arialcrime
arialcrime / roboFontCompDoubleClick.py
Last active February 15, 2022 19:55 — forked from typoman/roboFontCompDoubleClick.py
Fork using Subscriber; RoboFont startup script to enable jump to base glyph of componets by double clicking on the component in glyph view.
from defconAppKit.windows.baseWindow import BaseWindowController
from vanilla import FloatingWindow
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber
from mojo.UI import SetCurrentGlyphByName
"""
RoboFont Helper
Type: Start up
Purpose: After it's run, if you double click on a component it will jump to its base glyph.
"""
@arialcrime
arialcrime / expand-groups-to-components.py
Created January 26, 2021 13:50 — forked from typoman/expand-groups-to-components.py
A RoboFont script to expand kerning groups from base glyph to their composites.
from mojo.UI import CurrentWindow
from simpleKerning import *
"""
A RoboFont script to expand kerning groups from base glyph to their composites.
You need the simple kerning extension installed for this to work.
1. Select base glyph(s) (with contours) which are already grouped
2. Run the script
3. The groups will be expanded to the composites, if:
- Their width is same as the base glyph
@arialcrime
arialcrime / Generate_UFO_instances.py
Created August 1, 2019 14:39
Creates UFO files of all instances with production names.
#MenuTitle: Generate UFO instances
# -*- coding: utf-8 -*-
from __future__ import print_function
__doc__="""
Creates UFO files of all instances with production names.
"""
import os
@arialcrime
arialcrime / Store_glyph_info_in_glyphsapp_file.py
Created May 14, 2019 10:47
Finds all target script glyphs and adds Script, Category and Subcategory to the glyphs file
# in the current font
# add script, category and subcategory to glyphs matching “target_script”
# this enables exchange between people using non-standard glyph names
# TODO: could also work with selection
# Set target script
# initiate collection list
target_script = "arabic"
glyphs_to_store = []
@arialcrime
arialcrime / FindLowercaseGlyphs.py
Last active April 19, 2019 17:35
Gets you the length of a list containing lowercase glyph names
font = CurrentFont()
all_glyphs = font.glyphOrder
lc_list = []
exceptions = ['germandbls','dotlessi','dotlessj','napostroph']
case_extension = '.uc'
for glyph_name in all_glyphs:
lc_glyph = None
if glyph_name[0].isupper() or glyph_name in exceptions:
@arialcrime
arialcrime / NameGenerator.py
Created December 17, 2018 15:47
Generates a number of “names” following vowel/consonants-pattern
import string, random
v = 'aeiou'
c = string.ascii_lowercase
c = [l for l in c if l not in v]
d = dict(v = list(v),c = list(c))
wordNum = 300
pattern = 'cvcvc'
# in the current font
# add lowercase unicodes to uppercase characters
# requires compositor for mapping uppercase to lowercase, https://github.com/typesupply/compositor
from compositor.caseConversionMaps import upperToSingleLower
f = CurrentFont()
for g in f:
@arialcrime
arialcrime / FindMissingGlyphsInFonts.py
Created September 2, 2018 12:02
Quick script to check glyph sets of fonts against each other
from mojo.UI import GetFile
font_paths = GetFile(allowsMultipleSelection=True)
fonts = FontsList()
for font_path in font_paths:
f = OpenFont(font_path, showInterface=False)
fonts.append(f)
glyph_set_dict = {}
@arialcrime
arialcrime / SampleWordChecker.py
Last active March 30, 2018 12:07
A small script to check if all characters from A-Z and a-z are being used in a given amount of sample words.
import string
# to check for uppercase as well, just uncomment in line 4
wanted = string.ascii_lowercase #+ string.ascii_uppercase
used = 'Insert words here'
used = used.replace(' ', '')
list(used)
required = [letter for letter in wanted if letter not in used]
required = ''.join(required)
print ('STILL MISSING:\n' + required)
@arialcrime
arialcrime / LockZoomObserver.py
Created March 17, 2018 13:49
Observer to lock zoom level in Robofont
from mojo.UI import CurrentGlyphWindow
from mojo.events import addObserver
class LockZoomObserver:
def __init__(self):
addObserver(self, "ZoomObserver", "modifiersChanged")
def ZoomObserver(self, info):
gw = CurrentGlyphWindow()
viewScale = gw.getGlyphViewScale()