Skip to content

Instantly share code, notes, and snippets.

View anthrotype's full-sized avatar
🤔
debating umlauts

Cosimo Lupo anthrotype

🤔
debating umlauts
  • London
View GitHub Profile
@anthrotype
anthrotype / ttfautohint-qmake.patch
Created July 21, 2018 11:50
ttfautohint-qmake.patch
diff --git a/m4/autotroll.m4 b/m4/autotroll.m4
index 658251b..b5060df 100644
--- a/m4/autotroll.m4
+++ b/m4/autotroll.m4
@@ -267,7 +267,7 @@ AC_DEFUN([AT_WITH_QT],
dnl (
darwin*)
at_darwin=yes
- at_qmake_args='-spec macx-g++'
+ at_qmake_args='-spec macx-clang'
@anthrotype
anthrotype / ttdiff.sh
Last active July 18, 2018 10:03
Compare fonts with fonttools ttx
# compare fonts with ttx
ttdiff () {
if [ "$#" -lt 2 ]
then
echo "Usage: ttdiff FONT1.ttf FONT2.ttf [tables ...]"
return 1
fi
first="$1"
if [ ! -f "$first" ]; then
echo "File $first not found"
@anthrotype
anthrotype / openClosePairText.diff
Created October 26, 2017 09:48
Diff between openClosePairText as generated by openClosedUniGenerator.py and unicodeTools.py@bc9a915
diff --git a/Lib/defcon/tools/unicodeTools.py b/Lib/defcon/tools/unicodeTools.py
index 2edac23..f0ea587 100644
--- a/Lib/defcon/tools/unicodeTools.py
+++ b/Lib/defcon/tools/unicodeTools.py
@@ -2979,10 +2979,18 @@ _openClosePairText = """
2018;LEFT SINGLE QUOTATION MARK;Pi
2019;RIGHT SINGLE QUOTATION MARK;Pf
-201C;LEFT DOUBLE QUOTATION MARK;Pi
+#201B;SINGLE HIGH-REVERSED-9 QUOTATION MARK;Pi
@anthrotype
anthrotype / svg2glif.py
Created September 8, 2017 13:02
svg2glif: convert SVG paths to UFO glyphs
#!/usr/bin/env python
""" Convert SVG paths to UFO glyphs.
"""
# Author: Cosimo Lupo
# Email: cosimo@anthrotype.com
# License: Apache Software License 2.0
from __future__ import print_function, absolute_import
__requires__ = ["svg.path", "ufoLib", "FontTools"]
@anthrotype
anthrotype / roundtrip.py
Last active September 4, 2017 20:44
Test parsing/writing of .glyphs files with glyphsLib master vs 'classtree' branch
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
from fontTools.misc.py23 import open, StringIO, tounicode, tostr
import difflib
from glyphsLib import loads
try:
@anthrotype
anthrotype / hashfont.py
Created November 18, 2015 18:26
hashfont.py
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
from fontTools.ttLib import TTFont
import sys
from io import BytesIO
import struct
import hashlib
@anthrotype
anthrotype / fl_unittest_example.py
Last active October 7, 2015 15:07 — forked from marcdama/gist:02520ffbd11e2067ae87
fl_unittest_example.py
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
@anthrotype
anthrotype / woff2_glyf_test.py
Created March 31, 2015 18:29
fontTools WOFF2 glyf table roundtrip test
#!/usr/bin/env python
"""
Test that reconstructed 'glyf' and 'loca' table data are bitwise identical to
the original, 'normalised' table data.
"""
from __future__ import print_function
import sys
import struct
from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont
@anthrotype
anthrotype / woff2_roundtrip_test.py
Last active August 29, 2015 14:18
fontTools WOFF2 encoder roundtrip test
#!/usr/bin/env python
"""
if input font is SFNT:
- create normalised font
- compress input font to WOFF2
- decompress WOFF2
- diff normalised and decompressed font
else if input font is WOFF2:
- decompress input font to SFNT
"""