Skip to content

Instantly share code, notes, and snippets.

View mekkablue's full-sized avatar

Rainer Erich Scheichelbauer mekkablue

View GitHub Profile
@mekkablue
mekkablue / Diacritic Ligature Maker.py
Created July 27, 2019 10:19
Diacritic Ligature Maker
#MenuTitle: Diacritic Ligature Maker
# -*- coding: utf-8 -*-
__doc__="""
For selected ligatures with appropriate anchors (top_1, top_2, etc.), all possible diacritic variations are created. E.g., A_h -> Adieresis_h, Aacute_h, A_hcircumflex, Adieresis_hcircumflex, etc.
"""
import itertools, traceback
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # active master
@mekkablue
mekkablue / Align All Components.py
Created July 27, 2019 14:06
Align All Components
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
thisFont = Glyphs.font # frontmost font
listOfSelectedLayers = thisFont.selectedLayers # active layers of selected glyphs
def process( thisLayer ):
@mekkablue
mekkablue / Rebuild Components in Place.py
Created July 27, 2019 14:10
Rebuild Components in Place
#MenuTitle: Rebuild Components in Place
# -*- coding: utf-8 -*-
__doc__="""
Moves outlines to background, then tries to rebuild the glyph with components in the foreground. Tries to position the accents as precisely as possible.
"""
import traceback
Font = Glyphs.font
@mekkablue
mekkablue / New Tab with Correlated Diacritics.py
Created July 27, 2019 14:55
New Tab with Correlated Diacritics
#MenuTitle: New Tab with Correlated Diacritics
# -*- coding: utf-8 -*-
__doc__="""
Goes through your uppercase letters and lists all related glyphs in a new tab. E.g., Eacute, eacute.sc, eacute, eacute.ss01. Useful for seeing if the marks are in sync.
"""
thisFont = Glyphs.font # frontmost font
uppercaseLetters = [g for g in thisFont.glyphs if g.category == "Letter" and g.subCategory == "Uppercase" and g.export and g.layers[0].components]
def lowercaseGlyphName( thisGlyph ):
@mekkablue
mekkablue / New Tab with Flipped Components.py
Created July 27, 2019 15:24
New Tab with Flipped Components
#MenuTitle: New Tab with Flipped Components
# -*- coding: utf-8 -*-
__doc__="""
Opens a new edit tab with components that are mirrored horizontally, vertically, or both.
"""
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # active master
listOfSelectedLayers = thisFont.selectedLayers # active layers of selected glyphs
@mekkablue
mekkablue / Insert Anchors into Ligatures.py
Last active July 27, 2019 15:38
Insert Anchors into Ligatures
#MenuTitle: Insert Anchors into Ligatures
# -*- coding: utf-8 -*-
__doc__="""
Inserts base glyph anchors into ligatures with appropriate extensions. E.g. c_e will have top_1, bottom_1, top_2, bottom_2, and ogonek_2.
"""
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # active master
thisFontMasterID = thisFontMaster.id
selectedLayers = thisFont.selectedLayers # active layers of selected glyphs
@mekkablue
mekkablue / Move accents to custom anchors.py
Created July 27, 2019 15:40
Move accents to custom anchors
#MenuTitle: Move accents to custom anchors
# -*- coding: utf-8 -*-
__doc__="""
Moves acute(.case) from 'top' to 'top_acute' anchors where available. And other accents likewise.
"""
Font = Glyphs.font
selectedGlyphs = [ x.parent for x in Font.selectedLayers ]
def customAnchorName( currentAnchorName, componentName ):
@mekkablue
mekkablue / Align all Arabic Double Marks in Current Master.py
Created July 27, 2019 15:45
Align all Arabic Double Marks in Current Master
#MenuTitle: Align all Arabic Double Marks in Current Master
# -*- coding: utf-8 -*-
__doc__="""
Re-aligns components in double marks (like shadda_damma-ar) to each other according to their anchors. Only for the current master.
"""
# brings macro window to front and clears its log:
Glyphs.clearLog()
@mekkablue
mekkablue / AXt Converter.py
Created July 27, 2019 15:46
AXt Converter
#MenuTitle: AXt Converter
# -*- coding: utf-8 -*-
__doc__="""
Converts glyphs from AXt Encoding to modern Unicode.
Attention: this script is not yet finished.
Please add suggestions in the Github Wiki:
https://github.com/mekkablue/Glyphs-Scripts/wiki/AXt-Converter
Thx!
"""
@mekkablue
mekkablue / Export CSV for Glyphs With Entry and Exit.py
Created July 27, 2019 15:47
Export CSV for Glyphs With Entry and Exit
#MenuTitle: Export CSV for Glyphs With Entry and Exit
# -*- coding: utf-8 -*-
__doc__="""
Creates a CSV file containing name of the glyph, the x and y distances, and the rectangle area between entry and exit anchors. Works for selected glyphs only.
"""
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # active master
listOfSelectedLayers = thisFont.selectedLayers # active layers of selected glyphs