Erik van Blokland 3646055ea2 initial import
git-svn-id: http://svn.robofab.com/trunk@1 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-07 17:40:34 +00:00

27 lines
744 B
Python
Executable File

#FLM: Construct ligatures based on dictionary
from robofab.world import CurrentFont
myFont = CurrentFont()
# myDict = {"fi": ["f", "i"], "fl": ["f", "l"]}
myDict = {"P": ["X", "Z"], "Q": ["Y", "Z"]}
# myDict = {"fi": ["f", "i"], "fl": ["f", "l"], "germandbls": ["s", "s"]}
# myDict = {"g": ["H", "f"], "h": ["H", "F"], "j": ["H", "I"], "K": ["H", "H"]}
for myLig in myDict:
for myBasechar in myDict[myLig]:
myDest = myFont[myLig]
mySource = myFont[myBasechar]
myDest.appendGlyph(mySource)
myWidth = mySource.width
for contour in myDest.contours:
contour.move((-myWidth, 0))
myDest.leftMargin = myFont[myDict[myLig][0]].leftMargin
myDest.rightMargin = myFont[myDict[myLig][-1]].rightMargin
myDest.update()
print "Done"