Repository navigation
Expand file tree
/
Copy pathfffontreport
More file actions
executable file
·159 lines (152 loc) · 4.94 KB
/
Copy pathfffontreport
File metadata and controls
executable file
·159 lines (152 loc) · 4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env python
'''Fontreport: A simple python FontForge script to show almost all the font metadata to help with diagnostics for release engineering and packaging
and to implement open font design best practises in the various internal fields.
You need a recent version of FontForge with its python module.
This works on all font formats FontForge supports.'''
__url__ = 'http://projects.palaso.org/projects/pysilfont'
__copyright__ = 'Copyright (c) 2013, SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'Nicolas Spalinger. Thanks to Martin Hosken for his help.'
__version__ = '1.0'
import fontforge, sys
''' version checking to make sure we have a decently recent FontForge '''
required_version = "20100212"
if fontforge.version() < required_version:
print ("Your version of FontForge is too old - %s or newer is required" % (required_version))
def main ():
for f in sys.argv[1:]:
font = fontforge.open(f)
''' simple usage output '''
if (len(sys.argv) < 2):
print " "
print ("---------------------------------------------------------------- ")
print "Usage: {0} [FILE.ttf|otf|woff|ufo|sfd/...]".format(sys.argv[0])
print (" ")
sys.exit(1)
''' get the names for the sfnt object '''
names = {}
for n in font.sfnt_names :
if n[0] == "English (US)" :
names[n[1]] = n[2]
print (" ")
print ("---------------------------------------------------------------- ")
print (" ")
print ("File: " + font.path)
print (" ")
print ("Fontname: " + font.fontname)
print (" ")
print ("Full name: " + font.fullname)
print (" ")
print ("Family name: ")
print (font.familyname)
print (" ")
print ("PostScript name: ")
print names.get ('PostScriptName')
print (" ")
print ("Full name: ")
print names.get ('Fullname')
print (" ")
print ("UniqueID: ")
print names.get ('UniqueID')
print (" ")
print ("Subfamily: ")
print names.get ('SubFamily')
print (" ")
print ("Preferred family: ")
print names.get ('Preferred Family')
print (" ")
print ("Compatible Full: ")
print names.get ('Compatible Full')
print (" ")
print ("Version: ")
print (font.version)
print ("Version (PS) " + font.version)
print (" ")
print ("PostScript Unique ID: ")
print (font.uniqueid)
print (" ")
print ("PostScript eXtended Unique ID: " + font.xuid)
print (" ")
print ("OS2 version: ")
print (font.os2_version)
print (" ")
print ("Weight: " + font.weight)
print (" ")
print ("Copyright: " + font.copyright)
print (" ")
print ("License: ")
print names.get('License')
print (" ")
print ("License URL: ")
print names.get('License URL')
print (" ")
print ("Designer: ")
print names.get('Designer')
print (" ")
print ("Designer URL: ")
print names.get('Designer URL')
print (" ")
print ("Manufacturer: ")
print names.get('Manufacturer')
print (" ")
print ("Vendor URL: ")
print names.get('Vendor URL')
print (" ")
print ("Trademark: ")
print names.get('Trademark')
print (" ")
print ("Embedding restrictions in OS2 fstype table - open fonts should have 0 (0:nothing 1:no-embedding 2:embedded-read-only-printable-previewable 3:embeddable-editable 4:editable-document 8:not-subsettable 9:bitmap-only. See http://partners.adobe.com/public/developer/opentype/index_os2.html#fst for details):")
print (font.os2_fstype)
print (" ")
print ("Vendor OS2 (Font editor): " + font.os2_vendor)
print (" ")
print ("Description: ")
print names.get('Descriptor')
print (" ")
print (" ")
print ("FONTLOG (internal field): ")
print (font.fontlog)
print (" ")
print ("Comment: ")
print (font.comment)
print (" ")
print ("Encoding:")
print font.encoding
print (" ")
print ("Classes:" )
print font.markClasses
print (" ")
print "Family class: " + str(font.os2_family_class)
print (" ")
print "Panose: " + str(font.os2_panose)
print (" ")
print ("GSUB:")
print font.gsub_lookups
for l in range(len(font.gsub_lookups)):
name = font.gsub_lookups[l]
print str(l) + " " + name
li = font.getLookupInfo(name)
print name + " " + str(li)
print (" ")
print ("GPOS:")
for l in range(len(font.gpos_lookups)):
name = font.gpos_lookups[l]
li = font.getLookupInfo(name)
print name
print name + " " + str(li)
print (" ")
print ("WOFF metadata:")
print (font.woffMetadata)
print (" ")
print ("WOFF revision:")
print (font.woffMajor)
print (font.woffMinor)
print (" ")
print ("Gasp table version: ")
print (font.gasp_version)
print (" ")
print ("SFNT revision: ")
print (font.sfntRevision)
print (" ")
if __name__ == '__main__':
main()