Created
August 29, 2012 03:40
-
-
Save anonymous/3506577 to your computer and use it in GitHub Desktop.
Crash.sfd
This file contains 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
SplineFontDB: 3.0 | |
FontName: Untitled1 | |
FullName: Untitled1 | |
FamilyName: Untitled1 | |
Weight: Medium | |
Copyright: Created by crafting with FontForge 2.0 (http://fontforge.sf.net) | |
UComments: "2012-8-28: Created." | |
Version: 001.000 | |
ItalicAngle: 0 | |
UnderlinePosition: -100 | |
UnderlineWidth: 50 | |
Ascent: 800 | |
Descent: 200 | |
LayerCount: 2 | |
Layer: 0 0 "Back" 1 | |
Layer: 1 0 "Fore" 0 | |
XUID: [1021 680 635471465 8958325] | |
FSType: 0 | |
OS2Version: 0 | |
OS2_WeightWidthSlopeOnly: 0 | |
OS2_UseTypoMetrics: 1 | |
CreationTime: 1346185020 | |
ModificationTime: 1346212160 | |
OS2TypoAscent: 0 | |
OS2TypoAOffset: 1 | |
OS2TypoDescent: 0 | |
OS2TypoDOffset: 1 | |
OS2TypoLinegap: 90 | |
OS2WinAscent: 0 | |
OS2WinAOffset: 1 | |
OS2WinDescent: 0 | |
OS2WinDOffset: 1 | |
HheadAscent: 0 | |
HheadAOffset: 1 | |
HheadDescent: 0 | |
HheadDOffset: 1 | |
OS2Vendor: 'PfEd' | |
DEI: 91125 | |
Encoding: ISO8859-1 | |
UnicodeInterp: none | |
NameList: Adobe Glyph List | |
DisplaySize: -96 | |
AntiAlias: 1 | |
FitToEm: 1 | |
WinInfo: 96 8 2 | |
Grid | |
-1000 465 m 0 | |
2000 465 l 0 | |
Named: "x height" | |
EndSplineSet | |
BeginChars: 258 6 | |
StartChar: n | |
Encoding: 110 110 0 | |
Width: 552 | |
VWidth: 0 | |
Flags: W | |
HStem: 0 90.7273<43 84 224 272 465 509> 384.818 80.1818<43 84> | |
VStem: 84 140<90.7273 324.902> 325 140<90.7273 325.581> | |
LayerCount: 2 | |
Fore | |
SplineSet | |
232 465 m 5 | |
232 409 l 5 | |
237 409 l 5 | |
270 419 305.457214355 471 361 471 c 4 | |
431.7890625 471 465 361 465 248 c 6 | |
465 90.7272720337 l 5 | |
509 90.7272720337 l 5 | |
509 0 l 5 | |
325 0 l 5 | |
325 254 l 6 | |
325 284 317 337 279 339 c 4 | |
242 341 224 298 224 260 c 6 | |
224 90.7272720337 l 5 | |
272 90.7272720337 l 5 | |
272 0 l 5 | |
43 0 l 5 | |
43 90.7272720337 l 5 | |
84 90.7272720337 l 5 | |
84 384.81817627 l 5 | |
43 384.81817627 l 5 | |
43 465 l 5 | |
112.333335876 465 162.666992188 465 232 465 c 5 | |
EndSplineSet | |
EndChar | |
StartChar: acute | |
Encoding: 180 180 1 | |
Width: 280 | |
VWidth: 0 | |
Flags: W | |
LayerCount: 2 | |
Fore | |
SplineSet | |
14 280 m 25 | |
88 230 l 25 | |
266 398 l 25 | |
128 416 l 25 | |
14 280 l 25 | |
EndSplineSet | |
EndChar | |
StartChar: acute.cap | |
Encoding: 256 -1 2 | |
Width: 280 | |
VWidth: 0 | |
Flags: W | |
LayerCount: 2 | |
Fore | |
SplineSet | |
14 280 m 25 | |
88 230 l 25 | |
266 398 l 25 | |
128 416 l 25 | |
14 280 l 25 | |
EndSplineSet | |
EndChar | |
StartChar: N | |
Encoding: 78 78 3 | |
Width: 1000 | |
VWidth: 0 | |
HStem: 0 21G<94 271> | |
VStem: 94 177<0 408> | |
LayerCount: 2 | |
Fore | |
SplineSet | |
94 0 m 25 | |
100 690 l 25 | |
265 690 l 25 | |
409 441 l 25 | |
436 675 l 25 | |
703 618 l 25 | |
631 -39 l 25 | |
481 -36 l 25 | |
265 408 l 25 | |
271 0 l 25 | |
94 0 l 25 | |
EndSplineSet | |
Refer: 2 -1 N 1 0 0 1 279 441 2 | |
EndChar | |
StartChar: NameMe.4 | |
Encoding: 257 -1 4 | |
Width: 552 | |
VWidth: 0 | |
Flags: HW | |
LayerCount: 2 | |
Fore | |
SplineSet | |
142 465 m 1 | |
142 409 l 1 | |
147 409 l 1 | |
180 419 165.45703125 471 221 471 c 0 | |
291.7890625 471 295 361 295 248 c 2 | |
295 20.7275390625 l 1 | |
339 20.7275390625 l 1 | |
339 0 l 1 | |
235 0 l 1 | |
235 304 l 6 | |
235 334 227 387 189 389 c 4 | |
152 391 134 348 134 310 c 6 | |
134 20.7275390625 l 1 | |
182 20.7275390625 l 1 | |
182 0 l 1 | |
43 0 l 1 | |
43 20.7275390625 l 1 | |
84 20.7275390625 l 1 | |
84 434.818359375 l 1 | |
43 434.818359375 l 1 | |
43 465 l 1 | |
112.333335876 465 72.6669921875 465 142 465 c 1 | |
EndSplineSet | |
EndChar | |
StartChar: o | |
Encoding: 111 111 5 | |
Width: 552 | |
VWidth: 0 | |
Flags: HW | |
LayerCount: 2 | |
Fore | |
SplineSet | |
142 465 m 1 | |
142 409 l 1 | |
147 409 l 1 | |
180 419 165.45703125 471 221 471 c 0 | |
291.7890625 471 295 361 295 248 c 2 | |
295 20.7275390625 l 1 | |
339 20.7275390625 l 1 | |
339 0 l 1 | |
235 0 l 1 | |
235 304 l 6 | |
235 334 227 387 189 389 c 4 | |
152 391 134 348 134 310 c 6 | |
134 20.7275390625 l 1 | |
182 20.7275390625 l 1 | |
182 0 l 1 | |
43 0 l 1 | |
43 20.7275390625 l 1 | |
84 20.7275390625 l 1 | |
84 434.818359375 l 1 | |
43 434.818359375 l 1 | |
43 465 l 1 | |
112.333335876 465 72.6669921875 465 142 465 c 1 | |
EndSplineSet | |
EndChar | |
EndChars | |
EndSplineFont |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# FontForge Simplepolator Glyphs OpenType V0.3-ot | |
# | |
# Copyright (c) 2012, Dave Crossland (dave@understandingfonts.com) | |
# Copyright (c) 2012, Michal Nowakowski (miszka@limes.com.pl) | |
# | |
# 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 >= 9: | |
fontforge.postError("Bad value", "1 to 9, 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 would be simpler in robofab :) | |
glyphs = [] | |
for g in font.selection.byGlyphs: | |
glyphs.append(g) | |
source1 = glyphs[0] | |
source2 = glyphs[1] | |
name = source1.glyphname | |
print "Adding %s Style Sets to %s" % (amount, name) | |
# create all the children | |
for x in range(amount+1): | |
# create the style set name | |
ss = 'ss'+ str(x+1).zfill(2) | |
glyphname = str(name) + '.' + ss | |
# create a char slot | |
g = font.createChar(-1, glyphname) | |
# make this undoable | |
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] | |
# 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 | |
if len(font.getLookupSubtables(lookup)) == 0: | |
subtable = lookup + '-0' | |
font.addLookupSubtable(lookup, subtable) | |
else: | |
subtable = font.getLookupSubtables(lookup)[0] | |
# 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 %s%%/%s%% %s/%s (%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