Skip to content

Instantly share code, notes, and snippets.

View hands-face-space.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simoncozens
simoncozens / popularity.json
Created Jun 16, 2021
Popularity of OpenType feature tags in the Google Fonts database
View popularity.json
{
"font_total": 3833,
"kern": 3162,
"liga": 2586,
"frac": 2579,
"sups": 2541,
"mark": 2531,
"aalt": 2518,
"ordn": 2494,
"locl": 2463,
View hb-repack.cc
#include <stdio.h>
#include "hb.hh"
uint64_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)] = { 0,0,0,0,0};
uint64_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)];
#include "main-font-text.hh"
#include "hb-open-type.hh"
#define HB_DEBUG 100
View Autokerning Nastaliq.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simoncozens
simoncozens / proof-headlines.py
Created Mar 5, 2021
A quick and dirty bit of python to dump out headlines containing certain characters
View proof-headlines.py
import requests
from urllib.parse import urlencode
languages = ["en"]
doneglyphs = " ABCDEFGHIJKLMNOPRQSTUVXYZabcdefghijklmnopqrstuvwxyz0123456789.,-"
API_TOKEN = "Use your own, not mine."
def get_a_page_of_headlines(page):
params = urlencode(
{"api_token": API_TOKEN, "languages": ",".join(languages), "page": page}
View dotty-svg.py
# Dot a Glyph
# Copyright 2019 Simon Cozens
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
View dotty.py
# Dot a Glyph
from fontTools.ttLib import TTFont
from beziers.path import BezierPath
from beziers.path.representations.fontparts import FontParts
from fontParts.world import *
from beziers.point import Point
from beziers.path.geometricshapes import Circle
import sys
@simoncozens
simoncozens / cmap-survey.py
Created Jul 10, 2020
Survey CMAP tables of installed fonts
View cmap-survey.py
from fontTools.ttLib import TTFont
import glob
from tabulate import tabulate
import os
import random
paths = [
os.path.expanduser("~/Library/Fonts"),
"/Library/Fonts",
View badkerndetector.py
from tensorfont.dataset import prepare_training_data
from tensorfont.generators import RandomPair
prepare_training_data()
def kern_generator():
rpg = RandomPair(196, 196, 76, "training")
gen = rpg.generator()
while True:
font, left, right = next(gen)
img1, perturbation = rpg.get_image(font, left, right, perturbation_range= [-100,100])
@simoncozens
simoncozens / interrofont.py
Created Apr 3, 2020
Interrofont: Show various data about a font from the command line
View interrofont.py
#!env python3
import sys
from fontTools.ttLib import TTFont
from argparse import ArgumentParser
import itertools
parser = ArgumentParser()
parser.add_argument("input",
help="font file to process", metavar="FILE")
parser.add_argument('-n', "--name", action='store_true',