Debian Codegraph @

ost-generate.py

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #####################################################################
2 #
3 # This file is part of Old Standard font family
4 # (http://www.thessalonica.org.ru/en/oldstandard.html) and is
5 # Copyright (C) 2006-2011 Alexey Kryukov <[email protected]>.
6 #
7 # This Font Software is licensed under the SIL Open Font License,
8 # Version 1.1.
9 #
10 # You should have received a copy of the license along with this Font
11 # Software. If this is not the case, go to (http://scripts.sil.org/OFL)
12 # for all the details including a FAQ.
13 #
14 #####################################################################/
15
16 import fontforge
17
18 base_name = "OldStandard"
19 full_name = "Old Standard"
20 styles = ("Regular", "Italic", "Bold")
21
22 def process_font(name, fname, style):
23 filename = name + "-" + style
24 font = fontforge.open(filename + ".sfd")
25
26 # This breaks Graphite rendering in Evince: see the page 40 in the manual
27 #font.head_optimized_for_cleartype = True
28
29 # Set encoding to mac in order to get first 256 GID's mapped as in the MacRoman
30 # codepage (otherwise we would get a defective cmap table for the Mac platform)
31 font.encoding = "mac"
32
33 # Add localized Fullname entries. Since we change family name for TTF output,
34 # there is no reason to store them directly in the file
35 ttnames = list( font.sfnt_names )
36 for ttname in ttnames:
37 if ttname[1] == 'SubFamily':
38 ttnames.append( ( ttname[0],'Fullname',"%s %s" % ( fname,ttname[2] ) ) )
39 font.sfnt_names = tuple( ttnames )
40
41 font.gasp_version = 1
42 font.gasp = (
43 ( 10 , ( 'antialias', 'symmetric-smoothing' ) ),
44 ( 20 , ( 'gridfit', 'gridfit+smoothing' ) ),
45 ( 65535, ( 'antialias', 'gridfit', 'symmetric-smoothing', 'gridfit+smoothing' ) ),
46 )
47 font.generate( filename + ".otf",flags=( "opentype","PfEd-colors","PfEd-lookups" ),layer="Fore" )
48
49 woff_meta = base_name + "-WOFF-metadata.xml"
50 f = file( woff_meta,'r' )
51 lines = f.readlines()
52 f.close()
53 font.woffMetadata = "".join( lines )
54 font.generate( filename + ".woff",layer="TTF" )
55
56 # Append the 'TT' suffix to various font names, including localized entries
57 for i in range( 0,len( ttnames )):
58 ttname = ttnames[i]
59 if ttname[1] == 'Fullname':
60 ttnames[i] = ( ttname[0],'Fullname',ttname[2].replace( fname,fname + " TT" ) )
61 font.sfnt_names = tuple( ttnames )
62 font.familyname = fname + " TT"
63 font.fullname = fname + " TT " + style
64 font.fontname = name + "TT-" + style
65
66 font.generate( filename + ".ttf",flags=( "opentype","old-kern","PfEd-colors","PfEd-lookups","dummy-dsig" ),layer="TTF" )
67
68 font.close()
69
70 for style in styles:
71 fontforge.setPrefs( "AutoHint",False )
72 fontforge.setPrefs( "ClearInstrsBigChanges",False )
73 fontforge.setPrefs( "CopyTTFInstrs",False )
74 process_font( base_name, full_name, style )