Debian Codegraph @

texmf-dist/doc/fonts/gnu-freefont/tools/generate/MacTT

raw
1 # vim: set filetype=python :
2 __license__ = """
3 This file is part of Gnu FreeFont.
4
5 Gnu FreeFont is free software: you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation, either version 3 of the License, or (at your option) any later
8 version.
9
10 Gnu FreeFont is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 Gnu FreeFont. If not, see <http://www.gnu.org/licenses/>.
16 """
17 __author__ = "Stevan White"
18 __email__ = "[email protected]"
19 __copyright__ = "Copyright 2009, 2010, 2012, Stevan White"
20 __date__ = "$Date: 2012-04-21 18:47:22 +0200 (Sat, 21 Apr 2012) $"
21 __version__ = "$Revision: 2231 $"
22
23 __doc__ = """
24 Convert fonts from FontForge's native SFD format to TrueType format
25 First auto-hints whole font
26
27 Old-style kern tables seem to be what is actually used by Windows and
28 some Linux programs such as OpenOffice.
29
30 According to the FAQ, need to pass Flags=(apple) to build Mac fonts.
31 But this option seems to rule out old-style kern tables
32 """
33
34 import fontforge
35 from sys import argv
36 from buildutils import *
37
38 scriptname = argv[0];
39 argc = len( argv )
40
41 if argc > 1:
42 for i in range( 1, argc ):
43 f = fontforge.open( argv[i] )
44 ttfile = f.fontname + ".mac.ttf"
45 vstr = trim_version_str( f )
46 print "Generating Mac TrueType file ", ttfile, ' ', vstr
47 f.selection.all()
48 f.autoHint()
49 f.autoInstr()
50 # Mac OS Font Book doesn't like the old-kern flag
51 #f.generate( ttfile, flags=('opentype','old-kern') )
52 f.close()
53 else:
54 print "Usage: " + scriptname + " font.sfd [font.sfd ...]"