-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfontembedding
executable file
·53 lines (46 loc) · 2.01 KB
/
fontembedding
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
#!/usr/bin/env python
'''Fontembedding: A simple python FontForge script to show the fstype (and a few other) fields
You need a recent version of FontForge with its python module.
This works on all font formats FontForge supports.'''
__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 ("Fontembedding")
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 ("Fontembedding:")
print ("---------------------------------------------------------------- ")
print (" ")
print ("File: " + font.path)
print (" ")
print ("Full name: " + font.fullname)
print (" ")
print ("Version: ")
print (font.version)
print (" ")
print ("Copyright: " + font.copyright)
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 (" ")
if __name__ == '__main__':
main()