Skip to content

Instantly share code, notes, and snippets.

@line0
line0 / gist:717d0229b9f604a0c9bf
Created January 9, 2015 22:09
fontlab macro: apply texture
def process(f, g, t, index):
fl.SetUndo(index)
upm = f.upm
g.RemoveOverlap()
outlines = Glyph(g)
g.Distance(upm/100, upm/100, 1)
g.RemoveOverlap()
outlines.Bsubtract(t)
g.Bsubtract(outlines)
@line0
line0 / gist:22f02ecd9edca8af23b1
Created January 9, 2015 20:19
2 little scripts for conkerer
script_name="Little Scripts"
script_description=""
script_version="0.0.1"
script_author="line0"
local LineCollection = require("a-mo.LineCollection")
local l0Common = require("l0.Common")
local ASSTags = require("l0.ASSTags")
function flattenClips(sub, sel)
script_name="Insert Line Breaks"
script_description=""
script_version="0.0.1"
script_author="line0"
local LineCollection = require("a-mo.LineCollection")
local util = require("aegisub.util")
local unicode = require("aegisub.unicode")
local l0Common = require("l0.Common")
local ASSTags = require("l0.ASSTags")
@line0
line0 / Texture Glyphs.py
Created September 10, 2014 09:51
Fontlab script: adds texture to selected glyphs by intersecting them with a glyph named "texture"
def process(f, g, t, index):
fl.SetUndo(index)
upm = f.upm
g.RemoveOverlap()
outlines = Glyph(g)
g.Distance(upm/100, upm/100, 1)
g.RemoveOverlap()
outlines.Bsubtract(t)
g.Bsubtract(outlines)
@line0
line0 / Select glyphs for stripping.py
Last active August 29, 2015 14:03
Fontlab Macro: select glyphs to be stripped from an hardcoded list, doesn't handle linked glyphs (multiple code points) properly, yet
sel = [
{"name": ".notdef", "unicode": None},
{"name": "cid1", "unicode": 0},
{"name": "cid2", "unicode": 33},
{"name": "cid3", "unicode": 34},
{"name": "cid4", "unicode": 35},
{"name": "cid5", "unicode": 36},
{"name": "cid6", "unicode": 37},
{"name": "cid7", "unicode": 38},
{"name": "cid8", "unicode": 39},
@line0
line0 / Raster Glyph.py
Last active August 29, 2015 14:02
FontLab Macro: raster/pixel selected glyphs. also useful for introducing aliasing.
import robofab
import random
def drawRaster(glyph, raster, box):
colCnt = len(raster)
rowCnt = len(raster[0])
pen = glyph.getPen()
offY = box[1]
offX = box[0]
@line0
line0 / Paste Glyph Selection.py
Created May 30, 2014 18:13
Fontlab Macro: paste glyph selection from clipboard
from Tkinter import Tk
tk = Tk()
import json
tk.withdraw()
sel = json.loads(tk.clipboard_get())
tk.destroy()
glyphs = fl.font.glyphs
fl.Unselect()
@line0
line0 / Copy Glyph Selection.py
Last active August 29, 2015 14:02
Fontlab Macro: copy glyph selection into clipboard
from Tkinter import Tk
tk = Tk()
import json
glyphs = fl.font.glyphs
sel = []
for i in range(len(glyphs)):
if fl.Selected(i):
sel.append({'name':glyphs[i].name, 'unicode':glyphs[i].unicode})
@line0
line0 / GetPixelColor.py
Created April 26, 2014 19:33
GetPixelColor AvsPmod macro
import wx
import ctypes as ct
class GetPoint(ct.Structure):
_fields_ = [("x", ct.c_long), ("y", ct.c_long)]
def get_mousepos():
pt = GetPoint()
ct.windll.user32.GetCursorPos(ct.byref(pt))
return int(pt.x), int(pt.y)
src=last
Spline36Resize(width*2,height*2)
a=tcolormask("$ffffb5 $ecc96c $eff1ac $eeecbf $ecc250 $eef1ee",14,false,true).mt_expand_multi(sw=4, sh=4).mt_inflate().Spline36Resize(1920,1080)
b=tcolormask("$ffffb5 $ecc96c $eff1ac $eeecbf $ecc250 $dcc85f",11,false,true).mt_expand_multi(sw=6, sh=6).mt_inpand_multi(sw=2,sh=2).Spline36Resize(1920,1080)
ribbon=src.tcolormask("$e57f7f",16).mt_expand_multi(sw=3, sh=3).mt_inflate()
exclude=src.tcolormask("$65a2a6 $2f91a6 $357d98 $47a9c0 $84b0af",12,false,true).mt_expand_multi(sw=8,sh=8).mt_inpand_multi(sw=8,sh=8).RemoveGrain(17).mt_invert()
b.Crop(0,0,1232,0).StackHorizontal(a.mt_logic(exclude,"and").Crop(1232,0,0,0)).mt_logic(ribbon, "or")
HiAA(aa="sangnom2", preaa=True, ss="nnedi3")
mt_invert().ConvertToY8()