|
Revision 1, 1.3 kB
(checked in by erik, 3 years ago)
|
initial import
|
- Property svn:executable set to
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
from robofab.world import CurrentFont |
|---|
| 4 |
from robofab.interface.all.dialogs import GetFolder, ProgressBar |
|---|
| 5 |
|
|---|
| 6 |
myFont = CurrentFont() |
|---|
| 7 |
myKerning = myFont.kerning |
|---|
| 8 |
myFontfam = myFont.info.familyName |
|---|
| 9 |
myFontstyle = myFont.info.styleName |
|---|
| 10 |
|
|---|
| 11 |
myPath = GetFolder() |
|---|
| 12 |
|
|---|
| 13 |
if myPath: |
|---|
| 14 |
myPath += ":" + myFontfam + "-" + myFontstyle + "_kern.txt" |
|---|
| 15 |
|
|---|
| 16 |
myFile = open(myPath, "w") |
|---|
| 17 |
myFile.write("<ASCII-MAC>" + chr(10)) |
|---|
| 18 |
myFile.write("<vsn:2.000000><fset:InDesign-Roman><ctable:=<Black:COLOR:CMYK:Process:0.000000,0.000000,0.000000,1.000000>>" + chr(10)) |
|---|
| 19 |
|
|---|
| 20 |
myBar = ProgressBar('Exporting kerning...', len(myKerning)) |
|---|
| 21 |
for myPair in myKerning: |
|---|
| 22 |
myComb = str(myPair).split() |
|---|
| 23 |
myLeft=myComb[0][2:-2] |
|---|
| 24 |
myRight=myComb[1][1:-2] |
|---|
| 25 |
myLeftid = myFont[myLeft].index |
|---|
| 26 |
myRightid = myFont[myRight].index |
|---|
| 27 |
|
|---|
| 28 |
myLine = "<pstyle:><pga:BaseLine><ct:" + myFontstyle + "><cs:11.000000><cl:14.100000><cf:" + myFontfam + "><pSG:" + str(myLeftid) + "><0xFFFD><pSG:><pSG:" + str(myRightid) + "><0xFFFD><pSG:><ct:><cs:><cl:><cf:><ct:Regular><cs:5.000000><cl:14.100000><cf:Andale Mono> " + str(myKerning[myPair]) + chr(10) + "<ct:><cs:><cl:><cf:><pga:>" |
|---|
| 29 |
myFile.write(myLine) |
|---|
| 30 |
myBar.tick() |
|---|
| 31 |
myFile.close() |
|---|
| 32 |
myBar.close() |
|---|
| 33 |
print "Generated kerning file for", myFontfam, myFontstyle |
|---|
| 34 |
print "Done" |
|---|