Skip to content

Instantly share code, notes, and snippets.

View RafalBuchner's full-sized avatar
😴
Sleeping

Rafał Buchner RafalBuchner

😴
Sleeping
View GitHub Profile

installing python for Glyphs 3

  1. Download the latest version of Python from python.org. (In our example it will be Python 3.12.3)

  2. Install Python with downloaded .pkg file

  3. open the terminal app which you can find in /System/Applications/Utilities/ folder

  4. install vanilla by copy/pasting following code and hitting enter: python3.12 -m pip install cocoa-vanilla

@RafalBuchner
RafalBuchner / build_the_build.py
Last active August 11, 2023 19:06
script that creates the build.py file based on roboFontExt stored in /build directory
import os
import plistlib
def createBuildTxt(path):
infoPath = os.path.join(
path,
"info.plist"
)
@RafalBuchner
RafalBuchner / __myExtensionName__Settings.py
Last active July 27, 2023 15:11
Subscriber, that will add additional button to Glyph Editor "Display..." menu
# ===================================
# INFO
# this is file, where you define your settings.
#
# - It is important to change __myExtensionName__ part in the file's name to to the actual name of your extension.
# - You should change all __myExtensionName__ entries to the actual name of your extension.
# - Add all your custom defaults to "defaults" variable.
#
# Imports below ARE MANDATORY:
# ===================================
@RafalBuchner
RafalBuchner / .gitignore
Created May 21, 2021 11:59
python / macos gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
familyName
styleName
styleMapFamilyName
styleMapStyleName
versionMajor
versionMinor
year
unitsPerEm
descender
xHeight
from mojo.UI import AllWindows
from mojo.events import addObserver
class ShadowlessRoboFont:
def __init__(self):
addObserver(self, 'shadowlessWindow','fontWindowDidOpen')
addObserver(self, 'shadowlessWindow' ,'spaceCenterDidOpen')
addObserver(self, 'shadowlessWindow' ,'glyphWindowDidOpen')
def shadowlessWindow(self, info):
@RafalBuchner
RafalBuchner / RoboFont_rightClick_contextual_menu.py
Created January 21, 2020 12:31
RoboFont_rightClick_contextual_menu.py
from mojo.events import addObserver
from AppKit import NSPasteboard, NSArray
def copy2clip(txt):
from AppKit import NSPasteboard, NSStringPboardType
pb = NSPasteboard.generalPasteboard()
pb.declareTypes_owner_([NSStringPboardType],None)
pb.setString_forType_(txt,NSStringPboardType)
class Contextual(object):
from fontTools.pens.pointPen import AbstractPointPen
class SortingPen(AbstractPointPen):
def __init__(self):
self._contours = []
self._components = []
# menuTitle : myCloud Export/Import
# shortCut : command+control+e
"""
code took from LettError known as Erik van Blokland (or Erik van Blokland known as LettError)
This is window that wraps the functionality explained here:
https://forum.robofont.com/topic/646/export-glyph-image-edit-on-ipad-reimport-as-background-image
https://gist.github.com/LettError/d0d2688abe959595a88b3fdb85c18db3
"""
from vanilla import FloatingWindow, SquareButton, TextBox
@RafalBuchner
RafalBuchner / PyCharm-robofont-external-tool.md
Last active May 5, 2019 21:54
PyCharm-robofont-external-tool

This short tutorial describes how to set up the RoboFont shell's command as an external tool in PyCharm:

  1. Go to Preferences…/External Tools

  2. hit + button

  3. in the "Name" field put something like "RoboFont Output"

     > in following steps, you need to pay attention to fill the entries precisely the same way as described