Skip to content

Instantly share code, notes, and snippets.

View mekkablue's full-sized avatar

Rainer Erich Scheichelbauer mekkablue

View GitHub Profile
@mekkablue
mekkablue / Baseline Wiggle.py
Created July 27, 2019 15:50
Baseline Wiggle
#MenuTitle: Baseline Wiggle
# -*- coding: utf-8 -*-
__doc__="""
Create pseudorandom GPOS baseline shift for all glyphs.
"""
import random
random.seed()
@mekkablue
mekkablue / Beowulferize.py
Created July 27, 2019 15:50
Beowulferize
#MenuTitle: Beowulferize
# -*- coding: utf-8 -*-
__doc__="""
Turns selected glyphs into a pseudorandom Beowulf-lookalike.
"""
# Please adjust to your own needs:
alphabets = 5 # how many variants of each glyph will be created
shatter = 12 # how far each single node may be moved each time
@mekkablue
mekkablue / Wackelpudding.py
Created July 27, 2019 15:51
Wackelpudding
#MenuTitle: Wackelpudding
# -*- coding: utf-8 -*-
__doc__="""
Create pseudorandom rotation feature for selected glyphs.
"""
maxangle = 20.0 # Maximum angle by which a glyph may rotate
minangle = 4.0
alphabets = 5 # Instances of rotated glyphs
linelength = 80 # length of the line the feature should be working on
@mekkablue
mekkablue / Glyph Names as Discretionary Ligatures.py
Created July 27, 2019 15:54
Glyph Names as Discretionary Ligatures
#MenuTitle: Glyph Names as Discretionary Ligatures
# -*- coding: utf-8 -*-
__doc__="""
Adds names of exporting glyphs without a Unicode value as ligatures into the dlig feature.
"""
thisFont = Glyphs.font # frontmost font
def updated_code( oldcode, beginsig, endsig, newcode ):
@mekkablue
mekkablue / Wrap and Extend Features.py
Created July 27, 2019 15:55
Wrap and Extend Features
#MenuTitle: Wrap and Extend Features
# -*- coding: utf-8 -*-
__doc__="""
Enclose all features with lookups and divide them into sub groups of 3000 lines max. It will also add the useExtension parameter allowing you to have a 32 bits limit insead of the 16 bits.
"""
import string
import re
@mekkablue
mekkablue / Build Kana Features.py
Created July 27, 2019 15:56
Build Kana Features
#MenuTitle: Build Kana Features
# -*- coding: utf-8 -*-
__doc__="""
Creates hkna, vkna and pkna OpenType features for Kana.
"""
thisFont = Glyphs.font # frontmost font
features = ("pkna","vkna")
def updatedCode( oldCode, beginSig, endSig, newCode ):
@mekkablue
mekkablue / Build ccmp for Hebrew Presentation Forms.py
Created July 27, 2019 15:57
Build ccmp for Hebrew Presentation Forms
#MenuTitle: Build ccmp for Hebrew Presentation Forms
# -*- coding: utf-8 -*-
__doc__="""
Builds the ccmp for precomposed uniFBxx glyphs, e.g. if you padagesh, you get 'sub pa dagesh by padagesh' in your ccmp.
"""
lookupTitle = "hebrewPresentationForms"
thisFont = Glyphs.font
theseGlyphs = thisFont.glyphs
firstMasterID = thisFont.masters[0].id
@mekkablue
mekkablue / Check Glyph Names.py
Created July 27, 2019 16:02
Check Glyph Names
#MenuTitle: Check Glyph Names
# encoding: utf-8
__doc__="""
Goes through all glyph names and looks for illegal characters.
"""
firstChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
otherChars = "0123456789._-"
legalChars = firstChars + otherChars
allowedNameExceptions = (".notdef", ".null")
@mekkablue
mekkablue / Copy Unicode-Sorted Glyph Name List.py
Created July 27, 2019 16:03
Copy Unicode-Sorted Glyph Name List
#MenuTitle: Copy Unicode-Sorted Glyph Name List
# -*- coding: utf-8 -*-
__doc__="""
Creates a glyph list of all encoded glyphs, in Unicode order, and puts in your clipboard for pasting.
"""
from AppKit import NSPasteboard
thisFont = Glyphs.font # frontmost font
@mekkablue
mekkablue / Create Center Guideline.py
Created July 27, 2019 16:05
Create Center Guideline
#MenuTitle: Create Center Guideline
# -*- coding: utf-8 -*-
__doc__="""
Creates a guideline, horizontally or vertically centered between two selected nodes.
"""
Font = Glyphs.font
FontMaster = Font.selectedFontMaster
selectedLayers = Font.selectedLayers
selectedLayer = selectedLayers[0]