Skip to content

Instantly share code, notes, and snippets.

@davelab6
Created August 25, 2012 15:39
Show Gist options
  • Save davelab6/3467184 to your computer and use it in GitHub Desktop.
Save davelab6/3467184 to your computer and use it in GitHub Desktop.
FF crash
$ fontforge
Copyright (c) 2000-2012 by George Williams.
Executable based on sources from 14:57 GMT 31-Jul-2012-TtfDb-D.
Library based on sources from 14:57 GMT 31-Jul-2012.
A
()
lookupsubtables ('ss01-0',)
len 1
Created A.ss01 83pc/16pc A/B with ss01 ss01-0
('ss01',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-0',)
len 1
Created A.ss02 66pc/33pc A/B with ss01 ss02-0
('ss02', 'ss01')
('gsub_single', (), (('ss02', (('latn', ('dflt',)),)),))
('ss02-0',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss03-0',)
len 1
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-0',)
len 1
Created A.ss03 50pc/50pc A/B with ss01 ss03-0
('ss03', 'ss02', 'ss01')
('gsub_single', (), (('ss03', (('latn', ('dflt',)),)),))
('ss03-0',)
('gsub_single', (), (('ss02', (('latn', ('dflt',)),)),))
('ss02-0',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss04-0',)
len 1
lookupsubtables ('ss03-0',)
len 1
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-0',)
len 1
Created A.ss04 33pc/66pc A/B with ss01 ss04-0
('ss04', 'ss03', 'ss02', 'ss01')
('gsub_single', (), (('ss04', (('latn', ('dflt',)),)),))
('ss04-0',)
('gsub_single', (), (('ss03', (('latn', ('dflt',)),)),))
('ss03-0',)
('gsub_single', (), (('ss02', (('latn', ('dflt',)),)),))
('ss02-0',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss05-0',)
len 1
lookupsubtables ('ss04-0',)
len 1
lookupsubtables ('ss03-0',)
len 1
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-0',)
len 1
Created A.ss05 16pc/83pc A/B with ss01 ss05-0
('ss05', 'ss04', 'ss03', 'ss02', 'ss01')
('gsub_single', (), (('ss05', (('latn', ('dflt',)),)),))
('ss05-0',)
('gsub_single', (), (('ss04', (('latn', ('dflt',)),)),))
('ss04-0',)
('gsub_single', (), (('ss03', (('latn', ('dflt',)),)),))
('ss03-0',)
('gsub_single', (), (('ss02', (('latn', ('dflt',)),)),))
('ss02-0',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss06-0',)
len 1
lookupsubtables ('ss05-0',)
len 1
lookupsubtables ('ss04-0',)
len 1
lookupsubtables ('ss03-0',)
len 1
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-0',)
len 1
Created A.ss06 0pc/100pc A/B with ss01 ss06-0
A
('ss06', 'ss05', 'ss04', 'ss03', 'ss02', 'ss01')
('gsub_single', (), (('ss06', (('latn', ('dflt',)),)),))
('ss06-0',)
('gsub_single', (), (('ss05', (('latn', ('dflt',)),)),))
('ss05-0',)
('gsub_single', (), (('ss04', (('latn', ('dflt',)),)),))
('ss04-0',)
('gsub_single', (), (('ss03', (('latn', ('dflt',)),)),))
('ss03-0',)
('gsub_single', (), (('ss02', (('latn', ('dflt',)),)),))
('ss02-0',)
('gsub_single', (), (('ss01', (('latn', ('dflt',)),)),))
('ss01-0',)
lookupsubtables ('ss06-0',)
len 1
lookupsubtables ('ss05-0',)
len 1
lookupsubtables ('ss04-0',)
len 1
lookupsubtables ('ss03-0',)
len 1
lookupsubtables ('ss02-0',)
len 1
lookupsubtables ('ss01-1', 'ss01-0')
len 2
*** glibc detected *** fontforge: double free or corruption (fasttop): 0x09ac4000 ***
======= Backtrace: =========
/lib/libc.so.6(+0x9e3d61)[0xc83d61]
/usr/local/lib/libfontforge.so.1(PSTFree+0x64)[0x7c4814]
/usr/local/lib/libfontforge.so.1(SFRemoveLookupSubTable+0x2dd)[0x660b2d]
/usr/local/lib/libfontforge.so.1(+0x1580f0)[0x6f00f0]
/usr/lib/libpython2.6.so.1.0(PyCFunction_Call+0x12a)[0x33a325a]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x417b)[0x34000ab]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x85a)[0x340202a]
/usr/lib/libpython2.6.so.1.0[0x338f4b8]
/usr/lib/libpython2.6.so.1.0(PyObject_Call+0x5d)[0x3361ded]
/usr/lib/libpython2.6.so.1.0(PyEval_CallObjectWithKeywords+0x55)[0x33fb315]
fontforge[0x818b570]
fontforge[0x818b648]
/usr/local/lib/libgdraw.so.4(+0x5467b)[0x16467b]
/usr/local/lib/libgdraw.so.4(+0x54802)[0x164802]
/usr/local/lib/libgdraw.so.4(+0x807a8)[0x1907a8]
/usr/local/lib/libgdraw.so.4(+0x81700)[0x191700]
/usr/local/lib/libgdraw.so.4(GDrawEventLoop+0x24)[0x13a4f4]
fontforge[0x81b8827]
/lib/libc.so.6(__libc_start_main+0xe6)[0xc2bce6]
fontforge[0x805b921]
======= Memory map: ========
00110000-001b0000 r-xp 00000000 fd:00 144131 /usr/local/lib/libgdraw.so.4.0.10
001b0000-001cc000 rw-p 000a0000 fd:00 144131 /usr/local/lib/libgdraw.so.4.0.10
001cc000-001ce000 rw-p 00000000 00:00 0
001ce000-00408000 r-xp 00000000 fd:00 144155 /usr/local/lib/libgunicode.so.3.0.2
00408000-00449000 rw-p 00239000 fd:00 144155 /usr/local/lib/libgunicode.so.3.0.2
00449000-0057d000 r-xp 00000000 fd:00 144434 /usr/lib/libX11.so.6.3.0
0057d000-00581000 rw-p 00133000 fd:00 144434 /usr/lib/libX11.so.6.3.0
00581000-00583000 r-xp 00000000 fd:00 144432 /usr/lib/libXau.so.6.0.0
00583000-00584000 rw-p 00001000 fd:00 144432 /usr/lib/libXau.so.6.0.0
00584000-00585000 r-xp 00000000 fd:00 142353 /usr/lib/gconv/ISO8859-1.so
00585000-00586000 r--p 00000000 fd:00 142353 /usr/lib/gconv/ISO8859-1.so
00586000-00587000 rw-p 00001000 fd:00 142353 /usr/lib/gconv/ISO8859-1.so
00587000-00589000 r-xp 00000000 fd:00 142389 /usr/lib/gconv/MACINTOSH.so
00589000-0058a000 r--p 00001000 fd:00 142389 /usr/lib/gconv/MACINTOSH.so
0058a000-0058b000 rw-p 00002000 fd:00 142389 /usr/lib/gconv/MACINTOSH.so
0058b000-00594000 r-xp 00000000 fd:00 144445 /usr/lib/libXcursor.so.1.0.2
00594000-00595000 rw-p 00008000 fd:00 144445 /usr/lib/libXcursor.so.1.0.2
00595000-00597000 r-xp 00000000 fd:00 46329 /usr/lib/python2.6/lib-dynload/_randommodule.so
00597000-00598000 rw-p 00002000 fd:00 46329 /usr/lib/python2.6/lib-dynload/_randommodule.so
00598000-00895000 r-xp 00000000 fd:00 144135 /usr/local/lib/libfontforge.so.1.0.0
00895000-008f0000 rw-p 002fd000 fd:00 144135 /usr/local/lib/libfontforge.so.1.0.0
008f0000-008f3000 rw-p 00000000 00:00 0
008f3000-00910000 r-xp 00000000 fd:00 144433 /usr/lib/libxcb.so.1.1.0
00910000-00911000 rw-p 0001c000 fd:00 144433 /usr/lib/libxcb.so.1.1.0
00911000-00919000 r-xp 00000000 fd:00 144435 /usr/lib/libXrender.so.1.3.0
00919000-0091a000 rw-p 00008000 fd:00 144435 /usr/lib/libXrender.so.1.3.0
0091a000-0091e000 r-xp 00000000 fd:00 144444 /usr/lib/libXfixes.so.3.1.0
0091e000-0091f000 rw-p 00003000 fd:00 144444 /usr/lib/libXfixes.so.3.1.0
0091f000-00945000 r-xp 00000000 fd:00 65324 /lib/libexpat.so.1.5.2
00945000-00947000 rw-p 00025000 fd:00 65324 /lib/libexpat.so.1.5.2
00947000-0094a000 r-xp 00000000 fd:00 65336 /lib/libgmodule-2.0.so.0.2200.5
0094a000-0094b000 rw-p 00002000 fd:00 65336 /lib/libgmodule-2.0.so.0.2200.5
0094b000-0094e000 r-xp 00000000 fd:00 47418 /usr/lib/libpyglib-2.0-python.so.0.0.0
0094e000-0094f000 rw-p 00002000 fd:00 47418 /usr/lib/libpyglib-2.0-python.so.0.0.0
0094f000-0096d000 r-xp 00000000 fd:00 104 /lib/ld-2.12.so
0096d000-0096e000 r--p 0001d000 fd:00 104 /lib/ld-2.12.so
0096e000-0096f000 rw-p 0001e000 fd:00 104 /lib/ld-2.12.so
0096f000-00981000 r-xp 00000000 fd:00 65335 /lib/libz.so.1.2.3
00981000-00982000 r--p 00011000 fd:00 65335 /lib/libz.so.1.2.3
00982000-00983000 rw-p 00012000 fd:00 65335 /lib/libz.so.1.2.3
00983000-00984000 r-xs 00000000 fd:00 24707 /tmp/ffidY6wLM (deleted)
00984000-00985000 r-xp 00000000 00:00 0 [vdso]
00985000-009b8000 r-xp 00000000 fd:00 144430 /usr/lib/libfontconfig.so.1.4.4
009b8000-009ba000 rw-p 00032000 fd:00 144430 /usr/lib/libfontconfig.so.1.4.4
009ba000-00a4e000 r-xp 00000000 fd:00 144305 /usr/lib/libfreetype.so.6.3.22
00a4e000-00a52000 rw-p 00094000 fd:00 144305 /usr/lib/libfreetype.so.6.3.22
00a52000-00a99000 r-xp 00000000 fd:00 144437 /usr/lib/libpango-1.0.so.0.2800.1
00a99000-00a9b000 rw-p 00047000 fd:00 144437 /usr/lib/libpango-1.0.so.0.2800.1
00a9b000-00ade000 r-xp 00000000 fd:00 61693 /lib/libgobject-2.0.so.0.2200.5
00ade000-00adf000 rw-p 00043000 fd:00 61693 /lib/libgobject-2.0.so.0.2200.5
00adf000-00ae6000 r-xp 00000000 fd:00 144651 /usr/lib/libpangoxft-1.0.so.0.2800.1
00ae6000-00ae7000 rw-p 00006000 fd:00 144651 /usr/lib/libpangoxft-1.0.so.0.2800.1
00ae7000-00af2000 r-xp 00000000 fd:00 144439 /usr/lib/libpangocairo-1.0.so.0.2800.1
00af2000-00af3000 rw-p 0000a000 fd:00 144439 /usr/lib/libpangocairo-1.0.so.0.2800.1
00af3000-00af7000 r-xp 00000000 fd:00 46363 /usr/lib/python2.6/lib-dynload/stropmodule.so
00af7000-00af9000 rw-p 00004000 fd:00 46363 /usr/lib/python2.6/lib-dynload/stropmodule.so
00af9000-00b01000 r-xp 00000000 fd:00 46350 /usr/lib/python2.6/lib-dynload/itertoolsmodule.so
00b01000-00b04000 rw-p 00008000 fd:00 46350 /usr/lib/python2.6/lib-dynload/itertoolsmodule.so
00b04000-00b08000 r-xp 00000000 fd:00 46337 /usr/lib/python2.6/lib-dynload/binascii.so
00b08000-00b09000 rw-p 00004000 fd:00 46337 /usr/lib/python2.6/lib-dynload/binascii.so
00b09000-00b0c000 r-xp 00000000 fd:00 64283 /lib/libdl-2.12.so
00b0c000-00b0d000 r--p 00002000 fd:00 64283 /lib/libdl-2.12.so
00b0d000-00b0e000 rw-p 00003000 fd:00 64283 /lib/libdl-2.12.so
00b0e000-00b0f000 r-xp 00000000 fd:00 46303 /usr/lib/python2.6/lib-dynload/_bisectmodule.so
00b0f000-00b10000 rw-p 00001000 fd:00 46303 /usr/lib/python2.6/lib-dynload/_bisectmodule.so
00b10000-00b27000 r-xp 00000000 fd:00 23354 /lib/libpthread-2.12.so
00b27000-00b28000 r--p 00016000 fd:00 23354 /lib/libpthread-2.12.so
00b28000-00b29000 rw-p 00017000 fd:00 23354 /lib/libpthread-2.12.so
00b29000-00b2b000 rw-p 00000000 00:00 0
00b2d000-00b55000 r-xp 00000000 fd:00 64289 /lib/libm-2.12.so
00b55000-00b56000 r--p 00027000 fd:00 64289 /lib/libm-2.12.so
00b56000-00b57000 rw-p 00028000 fd:00 64289 /lib/libm-2.12.so
00b57000-00b80000 r-xp 00000000 fd:00 144438 /usr/lib/libpangoft2-1.0.so.0.2800.1
00b80000-00b81000 rw-p 00029000 fd:00 144438 /usr/lib/libpangoft2-1.0.so.0.2800.1
00b81000-00b86000 r-xp 00000000 fd:00 46352 /usr/lib/python2.6/lib-dynload/mathmodule.so
00b86000-00b88000 rw-p 00004000 fd:00 46352 /usr/lib/python2.6/lib-dynload/mathmodule.so
00b88000-00b96000 r-xp 00000000 fd:00 7783 /usr/lib/python2.6/site-packages/gtk-2.0/glib/_glib.so
00b96000-00b98000 rw-p 0000d000 fd:00 7783 /usr/lib/python2.6/site-packages/gtk-2.0/glib/_glib.so
00b98000-00b9c000 r-xp 00000000 fd:00 65340 /lib/libgthread-2.0.so.0.2200.5
00b9c000-00b9d000 rw-p 00003000 fd:00 65340 /lib/libgthread-2.0.so.0.2200.5
00b9d000-00ba4000 r-xp 00000000 fd:00 26095 /lib/librt-2.12.so
00ba4000-00ba5000 r--p 00006000 fd:00 26095 /lib/librt-2.12.soAborted
[crafting@type ~]$
#!/usr/bin/python
# -*- coding: utf-8 -*-
# FontForge Simplepolator Glyphs OpenType V0.3-ot
#
# Copyright (c) 2012, Dave Crossland ([email protected])
# Copyright (c) 2012, Michal Nowakowski ([email protected])
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
A FontForge plug-in to generate interpolated instances from 2 characters.
Inspired by the Simplepolator FontLab/RoboFont script by Pablo Impallari
found at http://www.impallari.com/projects/overview/simplepolation
to easily apply the Gunnlaugur SE Briem's method
http://66.147.242.192/~operinan/2/2.3.3a/2.3.3.02.tests.htm
Copy to ~/.FontForge/python/ and then find "Simplepolator" in the Tools menu,
active when 2 characters are selected.
"""
import fontforge
def copyAndPaste(font, source, target):
font.selection.select(source)
font.copy()
font.selection.select(target)
font.paste()
def note(message):
fontforge.logWarning(str(message))
print str(message)
def simplepolate(registerobject, font):
# Ask user how many children to create, default is 5
amount = 5
s = fontforge.askString("Simplepolate", "How many children? (1-8)", str(amount))
try:
amount = int(s)
except:
fontforge.postError("Bad value", "Expected whole number")
return
if 1 <= amount >= 8:
fontforge.postError("Bad value", "1 to 8, please")
return
# figure out the interpolation amount floats based on how many children the user requested
interpolationamount = []
calcamount = amount +1
x = 1.0 / calcamount
for y in range(1, calcamount):
interpolationamount.append(x*y)
interpolationamount.append(1.0)
# get the souce glyphs from the selection -- this should be simpler...
glyphs = []
for g in font.selection.byGlyphs:
glyphs.append(g)
source1 = glyphs[0]
source2 = glyphs[1]
name = source1.glyphname
print name
# create all the children
for x in range(amount+1):
ss = 'ss'+ str(x+1).zfill(2)
glyphname = str(name) + '.' + ss
g = font.createChar(-1, glyphname)
g.preserveLayerAsUndo(1)
# interpolate the top layer
g.layers[1] = source1.layers[1].interpolateNewLayer(source2.layers[1], interpolationamount[x])
# interpolate the width
g.width = source1.width + (source2.width - source1.width)*interpolationamount[x]
# interpolate the vwidth
g.vwidth = source1.vwidth + (source2.vwidth - source1.vwidth)*interpolationamount[x]
print font.gsub_lookups
# eg ('ss07', 'ss06', 'ss05', 'ss04', 'ss03', 'ss02', 'ss01')
for lookup in font.gsub_lookups:
lookupinfo = font.getLookupInfo(lookup)
print lookupinfo
# eg ('gsub_single', (), (('ss07', (('latn', ('dflt',)),)),))
# (lookup-type, lookup-flags, feature-script-lang-tuple)
# The lookup type is a string as described in addLookup, and the feature-script-lang tuple is also described there.
lookupsubtables = font.getLookupSubtables(lookup)
print lookupsubtables
# eg ('ss01-1',)
# add lookup for each ss, eg ss01, if it doesn't already exist
lookup = str(ss)
if lookup not in font.gsub_lookups:
flags = ("","")
featureScriptLangTuple = ((lookup,(("latn",("dflt")),)),)
# featureScriptLangTuple = (('ss07', (('latn', 'dflt'),)),)
font.addLookup(lookup, "gsub_single", (), featureScriptLangTuple)
# check for existing subtables
lookupsubtables = font.getLookupSubtables(lookup)
# add new subtable
subtable = lookup + '-' + str(len(lookupsubtables))
font.addLookupSubtable(lookup, subtable)
# add the substitution
source1.addPosSub(subtable,glyphname)
# merge the subtables
for lookup in font.gsub_lookups:
lookupsubtables = font.getLookupSubtables(lookup)
print 'lookupsubtables ', lookupsubtables
print 'len ', str(len(lookupsubtables))
while 1 < len(lookupsubtables):
for subtable in lookupsubtables:
font.mergeLookupSubtables(lookupsubtables[0],lookupsubtables[1])
# let folks know what we did
message = "Created %s %spc/%spc %s/%s with %s %s" % (glyphname, int(100-interpolationamount[x]*100), int(interpolationamount[x]*100), source1.glyphname, source2.glyphname, lookup, subtable)
note(message)
# Only enable Tool menu item if 2 characters are selected
def shouldWeAppear(registerobject, font):
font = fontforge.activeFont()
glyphs = []
for g in font.selection.byGlyphs:
glyphs.append(g)
if len(glyphs) == 2:
return True
else:
return False
# Register this PlugIn in the Tools menu
if fontforge.hasUserInterface():
# keyShortcut="Ctl+Shft+n"
keyShortcut = None
menuText = "Simplepolate Glyphs as OT SS"
fontforge.registerMenuItem(simplepolate,shouldWeAppear,None,"Font",keyShortcut,menuText);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment