Skip to content

Instantly share code, notes, and snippets.

from pathlib import Path
from defcon import Font
from os import utime
path = Path(__file__).parent
for ufo_path in path.rglob('*.ufo'):
vfb_path = ufo_path.with_suffix(".vfb")
print(vfb_path)
if vfb_path.exists:
f = Font(ufo_path)
@jenskutilek
jenskutilek / Font Development Environment.md
Created April 21, 2022 16:15
Migrating a font development environment to Apple Silicon

Installing a font development environment on Apple Silicon

I have a new Apple Silicon Mac and have migrated everything from my old Mac running macOS 10.13. That means that many Python and other command line tools are already installed, but may have been compiled for the wrong CPU type.

Python

I’m pretty sure that just installing the latest Python version will save us some trouble. Download and install Python 3.10.4 from https://www.python.org/downloads/release/python-3104/

Our system-wide Python packages (some of them include compiled libraries), e.g. powerline-status, have not been updated yet, so terminal apps won’t launch properly. Opening our ~.zshrc file and commenting out all lines that concern powerline, rbenv, and nvm/node makes Terminal.app and iTerm launch at least. But Python won’t run at all yet:

@jenskutilek
jenskutilek / settings.json
Last active April 26, 2024 11:05
VSCode settings
{
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.codeLens": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.hover.enabled": true,
"editor.parameterHints.enabled": true,
"editor.tabSize": 4,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
@jenskutilek
jenskutilek / yet.py
Created February 18, 2021 20:30
Typeface description generator
from random import choices
adjectives = """abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
import codecs
def afdko_escape_handler(exc):
if not isinstance(exc, UnicodeEncodeError):
raise TypeError("don't know how to handle %r" % exc)
result = []
for c in exc.object[exc.start:exc.end]:
result.append(r"\%04x" % ord(c))
return ("".join(result), exc.end)
set rtp+=~/Library/Python/3.7/lib/python/site-packages/powerline/bindings/vim/
set laststatus=2
set t_Co=256
filetype plugin indent on
syntax on
language en_GB
set mouse=r
@jenskutilek
jenskutilek / fl_minimal.ufo.htic
Created May 23, 2019 08:17
HTIC assembly instructions example
flags {
# As seen on VTT
X 1 # X X axis
Y 0 # Y Y axis
O 1 # O Use original outline
N 0 # N Use gridfitted outline
R 1 # R Round distance; or perpendicular to line
r 0 # r Do not round distance; or parallel to line
M 1 # M Set rp0 to point number on the stack
m 0 # m Do not set rp0
@jenskutilek
jenskutilek / avar-slant.py
Last active May 8, 2024 21:53
Axis variation mapping generator for the slant axis
#!/usr/bin/env python
# coding: utf-8
from __future__ import division, print_function
from math import atan, pi, tan
# Spit out some mappings for the slant axis to get closer to actual degrees.
#print(angle,
# atan(
# tan(slant * pi / 180) / (slant / angle)
from defcon import Font
from fontTools.pens.cocoaPen import CocoaPen
from drawBot.drawBotDrawingTools import _drawBotDrawingTool
def drawGlyph(glyph):
pen = CocoaPen(glyph.getParent())
glyph.draw(pen)
path = pen.path
_drawBotDrawingTool.drawPath(path)