This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pure CSS ePub theme detection (White / Sepia / Night) in iBooks (Mac OS and iOS included) | |
Version 1.1 | |
Note that iBooks actually uses internal JavaScript to set the "__ibooks_internal_theme" attribute on :root (html) element | |
every time the theme is changed, but this happens independently of whether your epub html markup is scripted or not. | |
Discovered and tested in iBooks on Mac, iPhone and iPad by | |
https://twitter.com/adaptivegarage | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import NSPoint | |
from mojo.events import MeasurementTool | |
measurement = MeasurementTool.measurementClass() | |
measurement.startPoint = NSPoint(100, 100) | |
measurement.endPoint = NSPoint(200, 200) | |
g = CurrentGlyph() | |
g.naked().measurements.append(measurement) | |
g.update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fonts = AllFonts() | |
for font in fonts: | |
for g in font: | |
if len(g.components) != 0: | |
for c in g.components: | |
b = font[c.baseGlyph] | |
if len(b.components) != 0: | |
e = b.components[0] | |
eb = e.baseGlyph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import vanilla | |
import mojo.canvas | |
from mojo.UI import PutFile | |
from random import random | |
from mojo.drawingTools import * | |
import drawBot | |
from AppKit import NSTimer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mojo.UI import CurrentFontWindow | |
import unicodedata | |
import AppKit | |
from vanilla import CheckBox, FloatingWindow, List | |
category_to_codepoints = {} | |
for code_point in range(0, 0xFFFF + 1): | |
category = unicodedata.category(chr(code_point)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"cmd": ["robofont", "-p", "$file"], | |
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", | |
"selector": "source.python", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
from mojo.events import installTool, EditingTool, BaseEventTool, setActiveEventTool | |
from mojo.drawingTools import * | |
from mojo.UI import UpdateCurrentGlyphView | |
from defconAppKit.windows.baseWindow import BaseWindowController | |
import math | |
# | |
# | |
# A visualisation for RoboFont |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
## anchorBaby.py | |
RoboFont script for keeping anchors consistent. | |
Inspired by an idea from James T. Edmondson, this script will take note of | |
anchor movement in a given glyph, and replicate that movement in all | |
dependent glyphs. | |
For instance, if a font has the glyphs `a` `a.init` and `a.fina`; and all three |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
if 'log_time' in kw: | |
name = kw.get('log_name', method.__name__.upper()) | |
kw['log_time'][name] = int((te - ts) * 1000) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from defconAppKit.windows.baseWindow import BaseWindowController | |
from vanilla import FloatingWindow | |
from mojo.events import addObserver, removeObserver | |
from mojo.UI import SetCurrentGlyphByName | |
""" | |
RoboFont Helper | |
Type: Start up | |
Purpose: After it's run, if you double click on a component it will jump to its base glyph. | |
""" |
OlderNewer