root/trunk/Documentation/TypoTechnica 2005/scripts Folder/Paulus - font/export glyphs to indd ot.py

Revision 1, 1.7 kB (checked in by erik, 3 years ago)

initial import

  • Property svn:executable set to
Line 
1 #FLM: Export glyphs naar tagged text OT
2
3 from robofab.world import CurrentFont
4 from robofab.interface.all.dialogs import GetFolder, ProgressBar
5
6 mySize = 44.0
7 myLeading = 48.0
8
9 myFont = CurrentFont()
10 myFontfam = myFont.info.otFamilyName
11 myFontstyle = myFont.info.otStyleName
12
13 myPagebreak = ""
14 myPath = GetFolder()
15
16 if myPath:
17         myPath += ":" + myFontfam + "-" + myFontstyle + ".txt"
18
19         myFile = open(myPath, "w")
20         try:
21                 myFile.write("<ASCII-MAC>" + chr(10))
22                 myFile.write("<vsn:2.000000><fset:InDesign-Roman><ctable:=<Black:COLOR:CMYK:Process:0.000000,0.000000,0.000000,1.000000>>" + chr(10))
23                
24                 myLine = myPagebreak + "<pstyle:><ct:Regular><cs:6.000000><cl:12.000000><cf:Andale Mono>" + myFontfam + "-" + myFontstyle + " glyph overview, generated 26 10 2004<cf:><cl:><cs:><ct:>" + chr(10) + "<pstyle:><ct:Regular><cs:6.000000><cl:12.000000><cf:Andale Mono>Version " + str(myFont.info.versionMajor) + "." + str(myFont.info.versionMinor) + ", designed by " + myFont.info.designer + ", " + str(myFont.info.year) + ".<cf:><cl:><cs:><ct:>" + chr(10) + "<pstyle:><ct:Regular><cs:9.000000><cl:14.000000><cf:Andale Mono><cf:><cl:><cs:><ct:>"  + chr(10) + "<pstyle:><cs:" + str(mySize) + "><cl:" + str(myLeading) + "><cf:TEFF><ct:Pi> | <ct:><cf:>"
25                 myFile.write(myLine)
26                
27                 myBar = ProgressBar('Exporting glyphs...', len(myFont))
28                 for myGlyph in range(1,len(myFont)):
29                         myLine = "<cf:" + myFontfam + "><ct:" + myFontstyle + "><pSG:" + str(myGlyph) + "><0xFFFD><pSG:><ct:><cf:><cf:TEFF><ct:Pi>| |<ct:><cf:>"
30                         myFile.write(myLine)
31                         myBar.tick()
32                 myFile.write("<cl:><cs:>")
33                 myPagebreak = "<cnxc:Page>"
34                 myFile.close()
35                 myBar.close()
36                 print "Generated glyph overview for", myFontfam + "-" + myFontstyle
37         except:
38                 myFile.close()
39                 print "An error occurred"
40 print "Done"
Note: See TracBrowser for help on using the browser.