Skip to content

Instantly share code, notes, and snippets.

View eliheuer's full-sized avatar

Eli Heuer eliheuer

View GitHub Profile
@eliheuer
eliheuer / mamikons-proof.py
Last active February 1, 2018 14:14
Mamikon's Proof of the Pythagorean Theorem.
# from drawBot import * # uncomment if using DrawBot as a module
import math
# static variables
pg = 512
num_frames = 100
origin = (pg/4, pg/4)
center = pg/2
@eliheuer
eliheuer / cartesian-unit-circle.py
Last active February 13, 2018 06:24
Basic unit circle in DrawBot with a cartesian point class
# Uncomment "from drawBot" line if using setupAsModule.py
# from drawBot import *
from math import *
# Static variables
W = 1024 # Width in pixels
H = 1024 # Height in pixels
FPS = 30 # Frames per seconds
SECONDS = 3
DURATION = 1 / FPS
#!/bin/bash
fontbakery check-googlefonts -c com.google.fonts/check/001 font.ttf &&
fontbakery check-googlefonts -c com.google.fonts/check/002 font.ttf &&
fontbakery check-googlefonts -c com.google.fonts/check/003 font.ttf
@eliheuer
eliheuer / iterate-color.py
Created August 9, 2018 19:26
For use with drawbot
newPage(256, 256)
fill(0)
rect(0, 0, 256, 256)
step = 0
for i in range(0, 11, 1):
color = i / 10.0
fill(1, color, 0)
rect(step, step, 32, 32)
step += 32
@eliheuer
eliheuer / build-vf.sh
Created September 5, 2018 17:46
Variable font build script
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@eliheuer
eliheuer / os.py
Created October 8, 2018 22:44
os test
# Render this specimen GIF with DrawBot3: http://www.drawbot.com/
import math
import os
# Basic variables (width, height, ):
W, H, M, F = 1024, 1024, 128, 32
# Load font and print font info:
# print(installedFonts(supportsCharacters=None))
os.chdir("..")
@eliheuer
eliheuer / font-var.py
Created November 6, 2018 17:21
get axes from a variable font
font("fonts/Font-VF.ttf")
for axis, data in listFontVariations().items():
print((axis, data)) # Get axis info from font
backend = "glx";
glx-no-stencil = true;
glx-copy-from-front = false;
glx-swap-method = 1;
blur-background = false;
blur-kern = "7x7box";
# Shadow
shadow = true; # Enabled client-side shadows on windows.
no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
no-dnd-shadow = true; # Don't draw shadows on DND windows.
@eliheuer
eliheuer / slack-logo.py
Created January 18, 2019 04:04
Slack logo in DrawBot
# RENDER WITH: http://www.drawbot.com/
from drawBot import *
# STATIC VARIABLES
W,H,M = 1000,1000,20 # WIDTH, HEIGHT, MARGIN
U = 32 # ONE GRID UNIT
font("Helvetica-Bold")
def grid(inc):
stroke(1)
@eliheuer
eliheuer / fontbakery_fix_valid_glyphnames.py
Created March 28, 2019 00:27
FontBakery Fix Check: valid_glyphnames
from fontTools.ttLib import TTFont
font = TTFont("TitilliumWeb-Roman-VF.ttf")
print(font)
glyphnames = font.getGlyphOrder()
def name_report(gns):
for i in gns:
print(i)
print("Glyph Count:", len(gns))
name_report(glyphnames)