Alexei Podtelezhnikov pushed to branch master
at FreeType / FreeType
Commits:
-
3f3427c6
by Azamat Hackimov
at 2022-09-28T22:35:49-04:00
* src/tools/*.py: Migrate to Python 3.
Fixes #1185, closes !205. Formatting changes according to PEP8.
3 changed files:
Changes:
src/tools/chktrcmp.py
1
|
|
-#!/usr/bin/env python
|
|
1
|
+#!/usr/bin/env python3
|
2
|
2
|
#
|
3
|
3
|
# Check trace components in FreeType 2 source.
|
4
|
4
|
# Author: suzuki toshiya, 2009, 2013, 2020
|
5
|
5
|
#
|
6
|
6
|
# This code is explicitly into the public domain.
|
7
|
7
|
|
8
|
|
-
|
9
|
8
|
import sys
|
10
|
9
|
import os
|
11
|
10
|
import re
|
12
|
11
|
|
13
|
|
-SRC_FILE_LIST = []
|
14
|
|
-USED_COMPONENT = {}
|
|
12
|
+SRC_FILE_LIST = []
|
|
13
|
+USED_COMPONENT = {}
|
15
|
14
|
KNOWN_COMPONENT = {}
|
16
|
15
|
|
17
|
|
-SRC_FILE_DIRS = [ "src" ]
|
18
|
|
-TRACE_DEF_FILES = [ "include/freetype/internal/fttrace.h" ]
|
|
16
|
+SRC_FILE_DIRS = ["src"]
|
|
17
|
+TRACE_DEF_FILES = ["include/freetype/internal/fttrace.h"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+def usage():
|
|
21
|
+ print("Usage: %s [option]" % sys.argv[0])
|
|
22
|
+ print("Search used-but-defined and defined-but-not-used trace_XXX macros")
|
|
23
|
+ print("")
|
|
24
|
+ print(" --help:")
|
|
25
|
+ print(" Show this help")
|
|
26
|
+ print("")
|
|
27
|
+ print(" --src-dirs=dir1:dir2:...")
|
|
28
|
+ print(" Specify the directories of C source files to be checked")
|
|
29
|
+ print(" Default is %s" % ":".join(SRC_FILE_DIRS))
|
|
30
|
+ print("")
|
|
31
|
+ print(" --def-files=file1:file2:...")
|
|
32
|
+ print(" Specify the header files including FT_TRACE_DEF()")
|
|
33
|
+ print(" Default is %s" % ":".join(TRACE_DEF_FILES))
|
|
34
|
+ print("")
|
19
|
35
|
|
20
|
36
|
|
21
|
37
|
# --------------------------------------------------------------
|
22
|
38
|
# Parse command line options
|
23
|
39
|
#
|
24
|
|
-
|
25
|
|
-for i in range( 1, len( sys.argv ) ):
|
26
|
|
- if sys.argv[i].startswith( "--help" ):
|
27
|
|
- print "Usage: %s [option]" % sys.argv[0]
|
28
|
|
- print "Search used-but-defined and defined-but-not-used trace_XXX macros"
|
29
|
|
- print ""
|
30
|
|
- print " --help:"
|
31
|
|
- print " Show this help"
|
32
|
|
- print ""
|
33
|
|
- print " --src-dirs=dir1:dir2:..."
|
34
|
|
- print " Specify the directories of C source files to be checked"
|
35
|
|
- print " Default is %s" % ":".join( SRC_FILE_DIRS )
|
36
|
|
- print ""
|
37
|
|
- print " --def-files=file1:file2:..."
|
38
|
|
- print " Specify the header files including FT_TRACE_DEF()"
|
39
|
|
- print " Default is %s" % ":".join( TRACE_DEF_FILES )
|
40
|
|
- print ""
|
41
|
|
- exit(0)
|
42
|
|
- if sys.argv[i].startswith( "--src-dirs=" ):
|
43
|
|
- SRC_FILE_DIRS = sys.argv[i].replace( "--src-dirs=", "", 1 ).split( ":" )
|
44
|
|
- elif sys.argv[i].startswith( "--def-files=" ):
|
45
|
|
- TRACE_DEF_FILES = sys.argv[i].replace( "--def-files=", "", 1 ).split( ":" )
|
46
|
|
-
|
|
40
|
+for i in range(1, len(sys.argv)):
|
|
41
|
+ if sys.argv[i].startswith("--help"):
|
|
42
|
+ usage()
|
|
43
|
+ exit(0)
|
|
44
|
+ if sys.argv[i].startswith("--src-dirs="):
|
|
45
|
+ SRC_FILE_DIRS = sys.argv[i].replace("--src-dirs=", "", 1).split(":")
|
|
46
|
+ elif sys.argv[i].startswith("--def-files="):
|
|
47
|
+ TRACE_DEF_FILES = sys.argv[i].replace("--def-files=", "", 1).split(":")
|
47
|
48
|
|
48
|
49
|
# --------------------------------------------------------------
|
49
|
50
|
# Scan C source and header files using trace macros.
|
50
|
51
|
#
|
51
|
52
|
|
52
|
|
-c_pathname_pat = re.compile( '^.*\.[ch]$', re.IGNORECASE )
|
53
|
|
-trace_use_pat = re.compile( '^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+' )
|
|
53
|
+c_pathname_pat = re.compile('^.*\.[ch]$', re.IGNORECASE)
|
|
54
|
+trace_use_pat = re.compile('^[ \t]*#define[ \t]+FT_COMPONENT[ \t]+')
|
54
|
55
|
|
55
|
56
|
for d in SRC_FILE_DIRS:
|
56
|
|
- for ( p, dlst, flst ) in os.walk( d ):
|
57
|
|
- for f in flst:
|
58
|
|
- if c_pathname_pat.match( f ) != None:
|
59
|
|
- src_pathname = os.path.join( p, f )
|
60
|
|
-
|
61
|
|
- line_num = 0
|
62
|
|
- for src_line in open( src_pathname, 'r' ):
|
63
|
|
- line_num = line_num + 1
|
64
|
|
- src_line = src_line.strip()
|
65
|
|
- if trace_use_pat.match( src_line ) != None:
|
66
|
|
- component_name = trace_use_pat.sub( '', src_line )
|
67
|
|
- if component_name in USED_COMPONENT:
|
68
|
|
- USED_COMPONENT[component_name].append( "%s:%d" % ( src_pathname, line_num ) )
|
69
|
|
- else:
|
70
|
|
- USED_COMPONENT[component_name] = [ "%s:%d" % ( src_pathname, line_num ) ]
|
71
|
|
-
|
|
57
|
+ for (p, dlst, flst) in os.walk(d):
|
|
58
|
+ for f in flst:
|
|
59
|
+ if c_pathname_pat.match(f) is not None:
|
|
60
|
+ src_pathname = os.path.join(p, f)
|
|
61
|
+
|
|
62
|
+ line_num = 0
|
|
63
|
+ for src_line in open(src_pathname, 'r'):
|
|
64
|
+ line_num = line_num + 1
|
|
65
|
+ src_line = src_line.strip()
|
|
66
|
+ if trace_use_pat.match(src_line) is not None:
|
|
67
|
+ component_name = trace_use_pat.sub('', src_line)
|
|
68
|
+ if component_name in USED_COMPONENT:
|
|
69
|
+ USED_COMPONENT[component_name]\
|
|
70
|
+ .append("%s:%d" % (src_pathname, line_num))
|
|
71
|
+ else:
|
|
72
|
+ USED_COMPONENT[component_name] =\
|
|
73
|
+ ["%s:%d" % (src_pathname, line_num)]
|
72
|
74
|
|
73
|
75
|
# --------------------------------------------------------------
|
74
|
76
|
# Scan header file(s) defining trace macros.
|
75
|
77
|
#
|
76
|
78
|
|
77
|
|
-trace_def_pat_opn = re.compile( '^.*FT_TRACE_DEF[ \t]*\([ \t]*' )
|
78
|
|
-trace_def_pat_cls = re.compile( '[ \t\)].*$' )
|
|
79
|
+trace_def_pat_opn = re.compile('^.*FT_TRACE_DEF[ \t]*\([ \t]*')
|
|
80
|
+trace_def_pat_cls = re.compile('[ \t\)].*$')
|
79
|
81
|
|
80
|
82
|
for f in TRACE_DEF_FILES:
|
81
|
|
- line_num = 0
|
82
|
|
- for hdr_line in open( f, 'r' ):
|
83
|
|
- line_num = line_num + 1
|
84
|
|
- hdr_line = hdr_line.strip()
|
85
|
|
- if trace_def_pat_opn.match( hdr_line ) != None:
|
86
|
|
- component_name = trace_def_pat_opn.sub( '', hdr_line )
|
87
|
|
- component_name = trace_def_pat_cls.sub( '', component_name )
|
88
|
|
- if component_name in KNOWN_COMPONENT:
|
89
|
|
- print "trace component %s is defined twice, see %s and fttrace.h:%d" % \
|
90
|
|
- ( component_name, KNOWN_COMPONENT[component_name], line_num )
|
91
|
|
- else:
|
92
|
|
- KNOWN_COMPONENT[component_name] = "%s:%d" % \
|
93
|
|
- ( os.path.basename( f ), line_num )
|
94
|
|
-
|
|
83
|
+ line_num = 0
|
|
84
|
+ for hdr_line in open(f, 'r'):
|
|
85
|
+ line_num = line_num + 1
|
|
86
|
+ hdr_line = hdr_line.strip()
|
|
87
|
+ if trace_def_pat_opn.match(hdr_line) is not None:
|
|
88
|
+ component_name = trace_def_pat_opn.sub('', hdr_line)
|
|
89
|
+ component_name = trace_def_pat_cls.sub('', component_name)
|
|
90
|
+ if component_name in KNOWN_COMPONENT:
|
|
91
|
+ print("trace component %s is defined twice,"
|
|
92
|
+ " see %s and fttrace.h:%d" %
|
|
93
|
+ (component_name, KNOWN_COMPONENT[component_name],
|
|
94
|
+ line_num))
|
|
95
|
+ else:
|
|
96
|
+ KNOWN_COMPONENT[component_name] =\
|
|
97
|
+ "%s:%d" % (os.path.basename(f), line_num)
|
95
|
98
|
|
96
|
99
|
# --------------------------------------------------------------
|
97
|
100
|
# Compare the used and defined trace macros.
|
98
|
101
|
#
|
99
|
102
|
|
100
|
|
-print "# Trace component used in the implementations but not defined in fttrace.h."
|
101
|
|
-cmpnt = USED_COMPONENT.keys()
|
|
103
|
+print("# Trace component used in the implementations but not defined in "
|
|
104
|
+ "fttrace.h.")
|
|
105
|
+cmpnt = list(USED_COMPONENT.keys())
|
102
|
106
|
cmpnt.sort()
|
103
|
107
|
for c in cmpnt:
|
104
|
|
- if c not in KNOWN_COMPONENT:
|
105
|
|
- print "Trace component %s (used in %s) is not defined." % ( c, ", ".join( USED_COMPONENT[c] ) )
|
|
108
|
+ if c not in KNOWN_COMPONENT:
|
|
109
|
+ print("Trace component %s (used in %s) is not defined." %
|
|
110
|
+ (c, ", ".join(USED_COMPONENT[c])))
|
106
|
111
|
|
107
|
|
-print "# Trace component is defined but not used in the implementations."
|
108
|
|
-cmpnt = KNOWN_COMPONENT.keys()
|
|
112
|
+print("# Trace component is defined but not used in the implementations.")
|
|
113
|
+cmpnt = list(KNOWN_COMPONENT.keys())
|
109
|
114
|
cmpnt.sort()
|
110
|
115
|
for c in cmpnt:
|
111
|
|
- if c not in USED_COMPONENT:
|
112
|
|
- if c != "any":
|
113
|
|
- print "Trace component %s (defined in %s) is not used." % ( c, KNOWN_COMPONENT[c] )
|
114
|
|
- |
|
116
|
+ if c not in USED_COMPONENT:
|
|
117
|
+ if c != "any":
|
|
118
|
+ print("Trace component %s (defined in %s) is not used." %
|
|
119
|
+ (c, KNOWN_COMPONENT[c])) |
src/tools/cordic.py
|
1
|
+#!/usr/bin/env python3
|
|
2
|
+
|
1
|
3
|
# compute arctangent table for CORDIC computations in fttrigon.c
|
2
|
|
-import sys, math
|
|
4
|
+import math
|
3
|
5
|
|
4
|
|
-#units = 64*65536.0 # don't change !!
|
5
|
|
-units = 180 * 2**16
|
6
|
|
-scale = units/math.pi
|
|
6
|
+# units = 64*65536.0 # don't change !!
|
|
7
|
+units = 180 * 2 ** 16
|
|
8
|
+scale = units / math.pi
|
7
|
9
|
shrink = 1.0
|
8
|
|
-comma = ""
|
|
10
|
+angles2 = []
|
9
|
11
|
|
10
|
|
-print ""
|
11
|
|
-print "table of arctan( 1/2^n ) for PI = " + repr(units/65536.0) + " units"
|
|
12
|
+print("")
|
|
13
|
+print("table of arctan( 1/2^n ) for PI = " + repr(units / 65536.0) + " units")
|
12
|
14
|
|
13
|
|
-for n in range(1,32):
|
|
15
|
+for n in range(1, 32):
|
14
|
16
|
|
15
|
|
- x = 0.5**n # tangent value
|
|
17
|
+ x = 0.5 ** n # tangent value
|
16
|
18
|
|
17
|
|
- angle = math.atan(x) # arctangent
|
18
|
|
- angle2 = round(angle*scale) # arctangent in FT_Angle units
|
|
19
|
+ angle = math.atan(x) # arctangent
|
|
20
|
+ angle2 = round(angle * scale) # arctangent in FT_Angle units
|
19
|
21
|
|
20
|
22
|
if angle2 <= 0:
|
21
|
23
|
break
|
22
|
24
|
|
23
|
|
- sys.stdout.write( comma + repr( int(angle2) ) )
|
24
|
|
- comma = ", "
|
25
|
|
-
|
26
|
|
- shrink /= math.sqrt( 1 + x*x )
|
27
|
|
-
|
28
|
|
-print
|
29
|
|
-print "shrink factor = " + repr( shrink )
|
30
|
|
-print "shrink factor 2 = " + repr( int( shrink * (2**32) ) )
|
31
|
|
-print "expansion factor = " + repr( 1/shrink )
|
32
|
|
-print ""
|
|
25
|
+ angles2.append(repr(int(angle2)))
|
|
26
|
+ shrink /= math.sqrt(1 + x * x)
|
33
|
27
|
|
|
28
|
+print(", ".join(angles2))
|
|
29
|
+print("shrink factor = " + repr(shrink))
|
|
30
|
+print("shrink factor 2 = " + repr(int(shrink * (2 ** 32))))
|
|
31
|
+print("expansion factor = " + repr(1 / shrink))
|
|
32
|
+print("") |
src/tools/glnames.py
1
|
|
-#!/usr/bin/env python
|
2
|
|
-#
|
|
1
|
+#!/usr/bin/env python3
|
3
|
2
|
|
4
|
3
|
#
|
5
|
4
|
# FreeType 2 glyph name builder
|
6
|
5
|
#
|
7
|
|
-
|
8
|
|
-
|
9
|
6
|
# Copyright (C) 1996-2022 by
|
10
|
7
|
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
11
|
8
|
#
|
... |
... |
@@ -16,8 +13,7 @@ |
16
|
13
|
# fully.
|
17
|
14
|
|
18
|
15
|
|
19
|
|
-"""\
|
20
|
|
-
|
|
16
|
+"""
|
21
|
17
|
usage: %s <output-file>
|
22
|
18
|
|
23
|
19
|
This python script generates the glyph names tables defined in the
|
... |
... |
@@ -26,9 +22,9 @@ usage: %s <output-file> |
26
|
22
|
Its single argument is the name of the header file to be created.
|
27
|
23
|
"""
|
28
|
24
|
|
29
|
|
-
|
30
|
|
-import sys, string, struct, re, os.path
|
31
|
|
-
|
|
25
|
+import os.path
|
|
26
|
+import struct
|
|
27
|
+import sys
|
32
|
28
|
|
33
|
29
|
# This table lists the glyphs according to the Macintosh specification.
|
34
|
30
|
# It is used by the TrueType Postscript names table.
|
... |
... |
@@ -39,379 +35,371 @@ import sys, string, struct, re, os.path |
39
|
35
|
#
|
40
|
36
|
# for the official list.
|
41
|
37
|
#
|
42
|
|
-mac_standard_names = \
|
43
|
|
-[
|
44
|
|
- # 0
|
45
|
|
- ".notdef", ".null", "nonmarkingreturn", "space", "exclam",
|
46
|
|
- "quotedbl", "numbersign", "dollar", "percent", "ampersand",
|
47
|
|
-
|
48
|
|
- # 10
|
49
|
|
- "quotesingle", "parenleft", "parenright", "asterisk", "plus",
|
50
|
|
- "comma", "hyphen", "period", "slash", "zero",
|
51
|
|
-
|
52
|
|
- # 20
|
53
|
|
- "one", "two", "three", "four", "five",
|
54
|
|
- "six", "seven", "eight", "nine", "colon",
|
55
|
|
-
|
56
|
|
- # 30
|
57
|
|
- "semicolon", "less", "equal", "greater", "question",
|
58
|
|
- "at", "A", "B", "C", "D",
|
59
|
|
-
|
60
|
|
- # 40
|
61
|
|
- "E", "F", "G", "H", "I",
|
62
|
|
- "J", "K", "L", "M", "N",
|
63
|
|
-
|
64
|
|
- # 50
|
65
|
|
- "O", "P", "Q", "R", "S",
|
66
|
|
- "T", "U", "V", "W", "X",
|
67
|
|
-
|
68
|
|
- # 60
|
69
|
|
- "Y", "Z", "bracketleft", "backslash", "bracketright",
|
70
|
|
- "asciicircum", "underscore", "grave", "a", "b",
|
71
|
|
-
|
72
|
|
- # 70
|
73
|
|
- "c", "d", "e", "f", "g",
|
74
|
|
- "h", "i", "j", "k", "l",
|
75
|
|
-
|
76
|
|
- # 80
|
77
|
|
- "m", "n", "o", "p", "q",
|
78
|
|
- "r", "s", "t", "u", "v",
|
79
|
|
-
|
80
|
|
- # 90
|
81
|
|
- "w", "x", "y", "z", "braceleft",
|
82
|
|
- "bar", "braceright", "asciitilde", "Adieresis", "Aring",
|
83
|
|
-
|
84
|
|
- # 100
|
85
|
|
- "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",
|
86
|
|
- "aacute", "agrave", "acircumflex", "adieresis", "atilde",
|
87
|
|
-
|
88
|
|
- # 110
|
89
|
|
- "aring", "ccedilla", "eacute", "egrave", "ecircumflex",
|
90
|
|
- "edieresis", "iacute", "igrave", "icircumflex", "idieresis",
|
91
|
|
-
|
92
|
|
- # 120
|
93
|
|
- "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
|
94
|
|
- "otilde", "uacute", "ugrave", "ucircumflex", "udieresis",
|
95
|
|
-
|
96
|
|
- # 130
|
97
|
|
- "dagger", "degree", "cent", "sterling", "section",
|
98
|
|
- "bullet", "paragraph", "germandbls", "registered", "copyright",
|
99
|
|
-
|
100
|
|
- # 140
|
101
|
|
- "trademark", "acute", "dieresis", "notequal", "AE",
|
102
|
|
- "Oslash", "infinity", "plusminus", "lessequal", "greaterequal",
|
103
|
|
-
|
104
|
|
- # 150
|
105
|
|
- "yen", "mu", "partialdiff", "summation", "product",
|
106
|
|
- "pi", "integral", "ordfeminine", "ordmasculine", "Omega",
|
107
|
|
-
|
108
|
|
- # 160
|
109
|
|
- "ae", "oslash", "questiondown", "exclamdown", "logicalnot",
|
110
|
|
- "radical", "florin", "approxequal", "Delta", "guillemotleft",
|
111
|
|
-
|
112
|
|
- # 170
|
113
|
|
- "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde",
|
114
|
|
- "Otilde", "OE", "oe", "endash", "emdash",
|
115
|
|
-
|
116
|
|
- # 180
|
117
|
|
- "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
|
118
|
|
- "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
|
119
|
|
-
|
120
|
|
- # 190
|
121
|
|
- "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",
|
122
|
|
- "periodcentered", "quotesinglbase", "quotedblbase", "perthousand",
|
|
38
|
+mac_standard_names = [
|
|
39
|
+ # 0
|
|
40
|
+ ".notdef", ".null", "nonmarkingreturn", "space", "exclam",
|
|
41
|
+ "quotedbl", "numbersign", "dollar", "percent", "ampersand",
|
|
42
|
+
|
|
43
|
+ # 10
|
|
44
|
+ "quotesingle", "parenleft", "parenright", "asterisk", "plus",
|
|
45
|
+ "comma", "hyphen", "period", "slash", "zero",
|
|
46
|
+
|
|
47
|
+ # 20
|
|
48
|
+ "one", "two", "three", "four", "five",
|
|
49
|
+ "six", "seven", "eight", "nine", "colon",
|
|
50
|
+
|
|
51
|
+ # 30
|
|
52
|
+ "semicolon", "less", "equal", "greater", "question",
|
|
53
|
+ "at", "A", "B", "C", "D",
|
|
54
|
+
|
|
55
|
+ # 40
|
|
56
|
+ "E", "F", "G", "H", "I",
|
|
57
|
+ "J", "K", "L", "M", "N",
|
|
58
|
+
|
|
59
|
+ # 50
|
|
60
|
+ "O", "P", "Q", "R", "S",
|
|
61
|
+ "T", "U", "V", "W", "X",
|
|
62
|
+
|
|
63
|
+ # 60
|
|
64
|
+ "Y", "Z", "bracketleft", "backslash", "bracketright",
|
|
65
|
+ "asciicircum", "underscore", "grave", "a", "b",
|
|
66
|
+
|
|
67
|
+ # 70
|
|
68
|
+ "c", "d", "e", "f", "g",
|
|
69
|
+ "h", "i", "j", "k", "l",
|
|
70
|
+
|
|
71
|
+ # 80
|
|
72
|
+ "m", "n", "o", "p", "q",
|
|
73
|
+ "r", "s", "t", "u", "v",
|
|
74
|
+
|
|
75
|
+ # 90
|
|
76
|
+ "w", "x", "y", "z", "braceleft",
|
|
77
|
+ "bar", "braceright", "asciitilde", "Adieresis", "Aring",
|
|
78
|
+
|
|
79
|
+ # 100
|
|
80
|
+ "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",
|
|
81
|
+ "aacute", "agrave", "acircumflex", "adieresis", "atilde",
|
|
82
|
+
|
|
83
|
+ # 110
|
|
84
|
+ "aring", "ccedilla", "eacute", "egrave", "ecircumflex",
|
|
85
|
+ "edieresis", "iacute", "igrave", "icircumflex", "idieresis",
|
|
86
|
+
|
|
87
|
+ # 120
|
|
88
|
+ "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
|
|
89
|
+ "otilde", "uacute", "ugrave", "ucircumflex", "udieresis",
|
|
90
|
+
|
|
91
|
+ # 130
|
|
92
|
+ "dagger", "degree", "cent", "sterling", "section",
|
|
93
|
+ "bullet", "paragraph", "germandbls", "registered", "copyright",
|
|
94
|
+
|
|
95
|
+ # 140
|
|
96
|
+ "trademark", "acute", "dieresis", "notequal", "AE",
|
|
97
|
+ "Oslash", "infinity", "plusminus", "lessequal", "greaterequal",
|
|
98
|
+
|
|
99
|
+ # 150
|
|
100
|
+ "yen", "mu", "partialdiff", "summation", "product",
|
|
101
|
+ "pi", "integral", "ordfeminine", "ordmasculine", "Omega",
|
|
102
|
+
|
|
103
|
+ # 160
|
|
104
|
+ "ae", "oslash", "questiondown", "exclamdown", "logicalnot",
|
|
105
|
+ "radical", "florin", "approxequal", "Delta", "guillemotleft",
|
|
106
|
+
|
|
107
|
+ # 170
|
|
108
|
+ "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde",
|
|
109
|
+ "Otilde", "OE", "oe", "endash", "emdash",
|
|
110
|
+
|
|
111
|
+ # 180
|
|
112
|
+ "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
|
|
113
|
+ "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
|
|
114
|
+
|
|
115
|
+ # 190
|
|
116
|
+ "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",
|
|
117
|
+ "periodcentered", "quotesinglbase", "quotedblbase", "perthousand",
|
123
|
118
|
"Acircumflex",
|
124
|
119
|
|
125
|
|
- # 200
|
126
|
|
- "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
|
127
|
|
- "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
|
|
120
|
+ # 200
|
|
121
|
+ "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
|
|
122
|
+ "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
|
128
|
123
|
|
129
|
|
- # 210
|
130
|
|
- "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",
|
131
|
|
- "dotlessi", "circumflex", "tilde", "macron", "breve",
|
|
124
|
+ # 210
|
|
125
|
+ "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",
|
|
126
|
+ "dotlessi", "circumflex", "tilde", "macron", "breve",
|
132
|
127
|
|
133
|
|
- # 220
|
134
|
|
- "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",
|
135
|
|
- "caron", "Lslash", "lslash", "Scaron", "scaron",
|
|
128
|
+ # 220
|
|
129
|
+ "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",
|
|
130
|
+ "caron", "Lslash", "lslash", "Scaron", "scaron",
|
136
|
131
|
|
137
|
|
- # 230
|
138
|
|
- "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
|
139
|
|
- "Yacute", "yacute", "Thorn", "thorn", "minus",
|
|
132
|
+ # 230
|
|
133
|
+ "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
|
|
134
|
+ "Yacute", "yacute", "Thorn", "thorn", "minus",
|
140
|
135
|
|
141
|
|
- # 240
|
142
|
|
- "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",
|
143
|
|
- "onequarter", "threequarters", "franc", "Gbreve", "gbreve",
|
|
136
|
+ # 240
|
|
137
|
+ "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",
|
|
138
|
+ "onequarter", "threequarters", "franc", "Gbreve", "gbreve",
|
144
|
139
|
|
145
|
|
- # 250
|
146
|
|
- "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute",
|
147
|
|
- "Ccaron", "ccaron", "dcroat"
|
|
140
|
+ # 250
|
|
141
|
+ "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute",
|
|
142
|
+ "Ccaron", "ccaron", "dcroat"
|
148
|
143
|
]
|
149
|
144
|
|
150
|
|
-
|
151
|
145
|
# The list of standard `SID' glyph names. For the official list,
|
152
|
146
|
# see Annex A of document at
|
153
|
147
|
#
|
154
|
|
-# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf .
|
|
148
|
+# https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf
|
155
|
149
|
#
|
156
|
|
-sid_standard_names = \
|
157
|
|
-[
|
158
|
|
- # 0
|
159
|
|
- ".notdef", "space", "exclam", "quotedbl", "numbersign",
|
160
|
|
- "dollar", "percent", "ampersand", "quoteright", "parenleft",
|
161
|
|
-
|
162
|
|
- # 10
|
163
|
|
- "parenright", "asterisk", "plus", "comma", "hyphen",
|
164
|
|
- "period", "slash", "zero", "one", "two",
|
165
|
|
-
|
166
|
|
- # 20
|
167
|
|
- "three", "four", "five", "six", "seven",
|
168
|
|
- "eight", "nine", "colon", "semicolon", "less",
|
169
|
|
-
|
170
|
|
- # 30
|
171
|
|
- "equal", "greater", "question", "at", "A",
|
172
|
|
- "B", "C", "D", "E", "F",
|
173
|
|
-
|
174
|
|
- # 40
|
175
|
|
- "G", "H", "I", "J", "K",
|
176
|
|
- "L", "M", "N", "O", "P",
|
177
|
|
-
|
178
|
|
- # 50
|
179
|
|
- "Q", "R", "S", "T", "U",
|
180
|
|
- "V", "W", "X", "Y", "Z",
|
181
|
|
-
|
182
|
|
- # 60
|
183
|
|
- "bracketleft", "backslash", "bracketright", "asciicircum", "underscore",
|
184
|
|
- "quoteleft", "a", "b", "c", "d",
|
185
|
|
-
|
186
|
|
- # 70
|
187
|
|
- "e", "f", "g", "h", "i",
|
188
|
|
- "j", "k", "l", "m", "n",
|
189
|
|
-
|
190
|
|
- # 80
|
191
|
|
- "o", "p", "q", "r", "s",
|
192
|
|
- "t", "u", "v", "w", "x",
|
193
|
|
-
|
194
|
|
- # 90
|
195
|
|
- "y", "z", "braceleft", "bar", "braceright",
|
196
|
|
- "asciitilde", "exclamdown", "cent", "sterling", "fraction",
|
197
|
|
-
|
198
|
|
- # 100
|
199
|
|
- "yen", "florin", "section", "currency", "quotesingle",
|
200
|
|
- "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi",
|
201
|
|
-
|
202
|
|
- # 110
|
203
|
|
- "fl", "endash", "dagger", "daggerdbl", "periodcentered",
|
204
|
|
- "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright",
|
205
|
|
-
|
206
|
|
- # 120
|
207
|
|
- "guillemotright", "ellipsis", "perthousand", "questiondown", "grave",
|
208
|
|
- "acute", "circumflex", "tilde", "macron", "breve",
|
209
|
|
-
|
210
|
|
- # 130
|
211
|
|
- "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut",
|
212
|
|
- "ogonek", "caron", "emdash", "AE", "ordfeminine",
|
213
|
|
-
|
214
|
|
- # 140
|
215
|
|
- "Lslash", "Oslash", "OE", "ordmasculine", "ae",
|
216
|
|
- "dotlessi", "lslash", "oslash", "oe", "germandbls",
|
217
|
|
-
|
218
|
|
- # 150
|
219
|
|
- "onesuperior", "logicalnot", "mu", "trademark", "Eth",
|
220
|
|
- "onehalf", "plusminus", "Thorn", "onequarter", "divide",
|
221
|
|
-
|
222
|
|
- # 160
|
223
|
|
- "brokenbar", "degree", "thorn", "threequarters", "twosuperior",
|
224
|
|
- "registered", "minus", "eth", "multiply", "threesuperior",
|
225
|
|
-
|
226
|
|
- # 170
|
227
|
|
- "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave",
|
228
|
|
- "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex",
|
229
|
|
-
|
230
|
|
- # 180
|
231
|
|
- "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis",
|
232
|
|
- "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis",
|
233
|
|
-
|
234
|
|
- # 190
|
235
|
|
- "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex",
|
236
|
|
- "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron",
|
237
|
|
-
|
238
|
|
- # 200
|
239
|
|
- "aacute", "acircumflex", "adieresis", "agrave", "aring",
|
240
|
|
- "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis",
|
241
|
|
-
|
242
|
|
- # 210
|
243
|
|
- "egrave", "iacute", "icircumflex", "idieresis", "igrave",
|
244
|
|
- "ntilde", "oacute", "ocircumflex", "odieresis", "ograve",
|
245
|
|
-
|
246
|
|
- # 220
|
247
|
|
- "otilde", "scaron", "uacute", "ucircumflex", "udieresis",
|
248
|
|
- "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall",
|
249
|
|
-
|
250
|
|
- # 230
|
251
|
|
- "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall",
|
|
150
|
+sid_standard_names = [
|
|
151
|
+ # 0
|
|
152
|
+ ".notdef", "space", "exclam", "quotedbl", "numbersign",
|
|
153
|
+ "dollar", "percent", "ampersand", "quoteright", "parenleft",
|
|
154
|
+
|
|
155
|
+ # 10
|
|
156
|
+ "parenright", "asterisk", "plus", "comma", "hyphen",
|
|
157
|
+ "period", "slash", "zero", "one", "two",
|
|
158
|
+
|
|
159
|
+ # 20
|
|
160
|
+ "three", "four", "five", "six", "seven",
|
|
161
|
+ "eight", "nine", "colon", "semicolon", "less",
|
|
162
|
+
|
|
163
|
+ # 30
|
|
164
|
+ "equal", "greater", "question", "at", "A",
|
|
165
|
+ "B", "C", "D", "E", "F",
|
|
166
|
+
|
|
167
|
+ # 40
|
|
168
|
+ "G", "H", "I", "J", "K",
|
|
169
|
+ "L", "M", "N", "O", "P",
|
|
170
|
+
|
|
171
|
+ # 50
|
|
172
|
+ "Q", "R", "S", "T", "U",
|
|
173
|
+ "V", "W", "X", "Y", "Z",
|
|
174
|
+
|
|
175
|
+ # 60
|
|
176
|
+ "bracketleft", "backslash", "bracketright", "asciicircum", "underscore",
|
|
177
|
+ "quoteleft", "a", "b", "c", "d",
|
|
178
|
+
|
|
179
|
+ # 70
|
|
180
|
+ "e", "f", "g", "h", "i",
|
|
181
|
+ "j", "k", "l", "m", "n",
|
|
182
|
+
|
|
183
|
+ # 80
|
|
184
|
+ "o", "p", "q", "r", "s",
|
|
185
|
+ "t", "u", "v", "w", "x",
|
|
186
|
+
|
|
187
|
+ # 90
|
|
188
|
+ "y", "z", "braceleft", "bar", "braceright",
|
|
189
|
+ "asciitilde", "exclamdown", "cent", "sterling", "fraction",
|
|
190
|
+
|
|
191
|
+ # 100
|
|
192
|
+ "yen", "florin", "section", "currency", "quotesingle",
|
|
193
|
+ "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi",
|
|
194
|
+
|
|
195
|
+ # 110
|
|
196
|
+ "fl", "endash", "dagger", "daggerdbl", "periodcentered",
|
|
197
|
+ "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright",
|
|
198
|
+
|
|
199
|
+ # 120
|
|
200
|
+ "guillemotright", "ellipsis", "perthousand", "questiondown", "grave",
|
|
201
|
+ "acute", "circumflex", "tilde", "macron", "breve",
|
|
202
|
+
|
|
203
|
+ # 130
|
|
204
|
+ "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut",
|
|
205
|
+ "ogonek", "caron", "emdash", "AE", "ordfeminine",
|
|
206
|
+
|
|
207
|
+ # 140
|
|
208
|
+ "Lslash", "Oslash", "OE", "ordmasculine", "ae",
|
|
209
|
+ "dotlessi", "lslash", "oslash", "oe", "germandbls",
|
|
210
|
+
|
|
211
|
+ # 150
|
|
212
|
+ "onesuperior", "logicalnot", "mu", "trademark", "Eth",
|
|
213
|
+ "onehalf", "plusminus", "Thorn", "onequarter", "divide",
|
|
214
|
+
|
|
215
|
+ # 160
|
|
216
|
+ "brokenbar", "degree", "thorn", "threequarters", "twosuperior",
|
|
217
|
+ "registered", "minus", "eth", "multiply", "threesuperior",
|
|
218
|
+
|
|
219
|
+ # 170
|
|
220
|
+ "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave",
|
|
221
|
+ "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex",
|
|
222
|
+
|
|
223
|
+ # 180
|
|
224
|
+ "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis",
|
|
225
|
+ "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis",
|
|
226
|
+
|
|
227
|
+ # 190
|
|
228
|
+ "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex",
|
|
229
|
+ "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron",
|
|
230
|
+
|
|
231
|
+ # 200
|
|
232
|
+ "aacute", "acircumflex", "adieresis", "agrave", "aring",
|
|
233
|
+ "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis",
|
|
234
|
+
|
|
235
|
+ # 210
|
|
236
|
+ "egrave", "iacute", "icircumflex", "idieresis", "igrave",
|
|
237
|
+ "ntilde", "oacute", "ocircumflex", "odieresis", "ograve",
|
|
238
|
+
|
|
239
|
+ # 220
|
|
240
|
+ "otilde", "scaron", "uacute", "ucircumflex", "udieresis",
|
|
241
|
+ "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall",
|
|
242
|
+
|
|
243
|
+ # 230
|
|
244
|
+ "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall",
|
252
|
245
|
"Acutesmall",
|
253
|
|
- "parenleftsuperior", "parenrightsuperior", "twodotenleader",
|
|
246
|
+ "parenleftsuperior", "parenrightsuperior", "twodotenleader",
|
254
|
247
|
"onedotenleader", "zerooldstyle",
|
255
|
248
|
|
256
|
|
- # 240
|
257
|
|
- "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle",
|
|
249
|
+ # 240
|
|
250
|
+ "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle",
|
258
|
251
|
"fiveoldstyle",
|
259
|
|
- "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle",
|
|
252
|
+ "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle",
|
260
|
253
|
"commasuperior",
|
261
|
254
|
|
262
|
|
- # 250
|
263
|
|
- "threequartersemdash", "periodsuperior", "questionsmall", "asuperior",
|
|
255
|
+ # 250
|
|
256
|
+ "threequartersemdash", "periodsuperior", "questionsmall", "asuperior",
|
264
|
257
|
"bsuperior",
|
265
|
|
- "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior",
|
|
258
|
+ "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior",
|
266
|
259
|
|
267
|
|
- # 260
|
268
|
|
- "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior",
|
269
|
|
- "tsuperior", "ff", "ffi", "ffl", "parenleftinferior",
|
|
260
|
+ # 260
|
|
261
|
+ "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior",
|
|
262
|
+ "tsuperior", "ff", "ffi", "ffl", "parenleftinferior",
|
270
|
263
|
|
271
|
|
- # 270
|
272
|
|
- "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall",
|
|
264
|
+ # 270
|
|
265
|
+ "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall",
|
273
|
266
|
"Asmall",
|
274
|
|
- "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall",
|
|
267
|
+ "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall",
|
275
|
268
|
|
276
|
|
- # 280
|
277
|
|
- "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall",
|
278
|
|
- "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall",
|
|
269
|
+ # 280
|
|
270
|
+ "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall",
|
|
271
|
+ "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall",
|
279
|
272
|
|
280
|
|
- # 290
|
281
|
|
- "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall",
|
282
|
|
- "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall",
|
|
273
|
+ # 290
|
|
274
|
+ "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall",
|
|
275
|
+ "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall",
|
283
|
276
|
|
284
|
|
- # 300
|
285
|
|
- "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall",
|
286
|
|
- "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall",
|
|
277
|
+ # 300
|
|
278
|
+ "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall",
|
|
279
|
+ "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall",
|
287
|
280
|
"Dieresissmall",
|
288
|
281
|
|
289
|
|
- # 310
|
290
|
|
- "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash",
|
291
|
|
- "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall",
|
|
282
|
+ # 310
|
|
283
|
+ "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash",
|
|
284
|
+ "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall",
|
292
|
285
|
"questiondownsmall",
|
293
|
286
|
|
294
|
|
- # 320
|
295
|
|
- "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird",
|
296
|
|
- "twothirds", "zerosuperior", "foursuperior", "fivesuperior",
|
|
287
|
+ # 320
|
|
288
|
+ "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird",
|
|
289
|
+ "twothirds", "zerosuperior", "foursuperior", "fivesuperior",
|
297
|
290
|
"sixsuperior",
|
298
|
291
|
|
299
|
|
- # 330
|
300
|
|
- "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior",
|
|
292
|
+ # 330
|
|
293
|
+ "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior",
|
301
|
294
|
"oneinferior",
|
302
|
|
- "twoinferior", "threeinferior", "fourinferior", "fiveinferior",
|
|
295
|
+ "twoinferior", "threeinferior", "fourinferior", "fiveinferior",
|
303
|
296
|
"sixinferior",
|
304
|
297
|
|
305
|
|
- # 340
|
306
|
|
- "seveninferior", "eightinferior", "nineinferior", "centinferior",
|
|
298
|
+ # 340
|
|
299
|
+ "seveninferior", "eightinferior", "nineinferior", "centinferior",
|
307
|
300
|
"dollarinferior",
|
308
|
|
- "periodinferior", "commainferior", "Agravesmall", "Aacutesmall",
|
|
301
|
+ "periodinferior", "commainferior", "Agravesmall", "Aacutesmall",
|
309
|
302
|
"Acircumflexsmall",
|
310
|
303
|
|
311
|
|
- # 350
|
312
|
|
- "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall",
|
313
|
|
- "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall",
|
|
304
|
+ # 350
|
|
305
|
+ "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall",
|
|
306
|
+ "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall",
|
314
|
307
|
"Igravesmall",
|
315
|
308
|
|
316
|
|
- # 360
|
317
|
|
- "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall",
|
|
309
|
+ # 360
|
|
310
|
+ "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall",
|
318
|
311
|
"Ntildesmall",
|
319
|
|
- "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall",
|
|
312
|
+ "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall",
|
320
|
313
|
"Odieresissmall",
|
321
|
314
|
|
322
|
|
- # 370
|
323
|
|
- "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall",
|
|
315
|
+ # 370
|
|
316
|
+ "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall",
|
324
|
317
|
"Ucircumflexsmall",
|
325
|
|
- "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall",
|
|
318
|
+ "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall",
|
326
|
319
|
"001.000",
|
327
|
320
|
|
328
|
|
- # 380
|
329
|
|
- "001.001", "001.002", "001.003", "Black", "Bold",
|
330
|
|
- "Book", "Light", "Medium", "Regular", "Roman",
|
|
321
|
+ # 380
|
|
322
|
+ "001.001", "001.002", "001.003", "Black", "Bold",
|
|
323
|
+ "Book", "Light", "Medium", "Regular", "Roman",
|
331
|
324
|
|
332
|
|
- # 390
|
333
|
|
- "Semibold"
|
|
325
|
+ # 390
|
|
326
|
+ "Semibold"
|
334
|
327
|
]
|
335
|
328
|
|
336
|
|
-
|
337
|
329
|
# This table maps character codes of the Adobe Standard Type 1
|
338
|
330
|
# encoding to glyph indices in the sid_standard_names table.
|
339
|
331
|
#
|
340
|
|
-t1_standard_encoding = \
|
341
|
|
-[
|
342
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
343
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
344
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
345
|
|
- 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
|
346
|
|
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
347
|
|
-
|
348
|
|
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
349
|
|
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
350
|
|
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
351
|
|
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
352
|
|
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
|
353
|
|
-
|
354
|
|
- 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
355
|
|
- 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
|
356
|
|
- 89, 90, 91, 92, 93, 94, 95, 0, 0, 0,
|
357
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
358
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
359
|
|
-
|
360
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
361
|
|
- 0, 96, 97, 98, 99, 100, 101, 102, 103, 104,
|
362
|
|
- 105, 106, 107, 108, 109, 110, 0, 111, 112, 113,
|
363
|
|
- 114, 0, 115, 116, 117, 118, 119, 120, 121, 122,
|
364
|
|
- 0, 123, 0, 124, 125, 126, 127, 128, 129, 130,
|
365
|
|
-
|
366
|
|
- 131, 0, 132, 133, 0, 134, 135, 136, 137, 0,
|
367
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
368
|
|
- 0, 0, 0, 0, 0, 138, 0, 139, 0, 0,
|
369
|
|
- 0, 0, 140, 141, 142, 143, 0, 0, 0, 0,
|
370
|
|
- 0, 144, 0, 0, 0, 145, 0, 0, 146, 147,
|
371
|
|
-
|
372
|
|
- 148, 149, 0, 0, 0, 0
|
|
332
|
+t1_standard_encoding = [
|
|
333
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
334
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
335
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
336
|
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
|
|
337
|
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
338
|
+
|
|
339
|
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
|
340
|
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
|
341
|
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
|
342
|
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
|
343
|
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
|
|
344
|
+
|
|
345
|
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
|
346
|
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
|
|
347
|
+ 89, 90, 91, 92, 93, 94, 95, 0, 0, 0,
|
|
348
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
349
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
350
|
+
|
|
351
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
352
|
+ 0, 96, 97, 98, 99, 100, 101, 102, 103, 104,
|
|
353
|
+ 105, 106, 107, 108, 109, 110, 0, 111, 112, 113,
|
|
354
|
+ 114, 0, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
355
|
+ 0, 123, 0, 124, 125, 126, 127, 128, 129, 130,
|
|
356
|
+
|
|
357
|
+ 131, 0, 132, 133, 0, 134, 135, 136, 137, 0,
|
|
358
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
359
|
+ 0, 0, 0, 0, 0, 138, 0, 139, 0, 0,
|
|
360
|
+ 0, 0, 140, 141, 142, 143, 0, 0, 0, 0,
|
|
361
|
+ 0, 144, 0, 0, 0, 145, 0, 0, 146, 147,
|
|
362
|
+
|
|
363
|
+ 148, 149, 0, 0, 0, 0
|
373
|
364
|
]
|
374
|
365
|
|
375
|
|
-
|
376
|
366
|
# This table maps character codes of the Adobe Expert Type 1
|
377
|
367
|
# encoding to glyph indices in the sid_standard_names table.
|
378
|
368
|
#
|
379
|
|
-t1_expert_encoding = \
|
380
|
|
-[
|
381
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
382
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
383
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
384
|
|
- 0, 0, 1, 229, 230, 0, 231, 232, 233, 234,
|
385
|
|
- 235, 236, 237, 238, 13, 14, 15, 99, 239, 240,
|
386
|
|
-
|
387
|
|
- 241, 242, 243, 244, 245, 246, 247, 248, 27, 28,
|
388
|
|
- 249, 250, 251, 252, 0, 253, 254, 255, 256, 257,
|
389
|
|
- 0, 0, 0, 258, 0, 0, 259, 260, 261, 262,
|
390
|
|
- 0, 0, 263, 264, 265, 0, 266, 109, 110, 267,
|
391
|
|
- 268, 269, 0, 270, 271, 272, 273, 274, 275, 276,
|
392
|
|
-
|
393
|
|
- 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
|
394
|
|
- 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
|
395
|
|
- 297, 298, 299, 300, 301, 302, 303, 0, 0, 0,
|
396
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
397
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
398
|
|
-
|
399
|
|
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
400
|
|
- 0, 304, 305, 306, 0, 0, 307, 308, 309, 310,
|
401
|
|
- 311, 0, 312, 0, 0, 313, 0, 0, 314, 315,
|
402
|
|
- 0, 0, 316, 317, 318, 0, 0, 0, 158, 155,
|
403
|
|
- 163, 319, 320, 321, 322, 323, 324, 325, 0, 0,
|
404
|
|
-
|
405
|
|
- 326, 150, 164, 169, 327, 328, 329, 330, 331, 332,
|
406
|
|
- 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
|
407
|
|
- 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,
|
408
|
|
- 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
|
409
|
|
- 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
|
410
|
|
-
|
411
|
|
- 373, 374, 375, 376, 377, 378
|
|
369
|
+t1_expert_encoding = [
|
|
370
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
371
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
372
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
373
|
+ 0, 0, 1, 229, 230, 0, 231, 232, 233, 234,
|
|
374
|
+ 235, 236, 237, 238, 13, 14, 15, 99, 239, 240,
|
|
375
|
+
|
|
376
|
+ 241, 242, 243, 244, 245, 246, 247, 248, 27, 28,
|
|
377
|
+ 249, 250, 251, 252, 0, 253, 254, 255, 256, 257,
|
|
378
|
+ 0, 0, 0, 258, 0, 0, 259, 260, 261, 262,
|
|
379
|
+ 0, 0, 263, 264, 265, 0, 266, 109, 110, 267,
|
|
380
|
+ 268, 269, 0, 270, 271, 272, 273, 274, 275, 276,
|
|
381
|
+
|
|
382
|
+ 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
|
|
383
|
+ 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
|
|
384
|
+ 297, 298, 299, 300, 301, 302, 303, 0, 0, 0,
|
|
385
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
386
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
387
|
+
|
|
388
|
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
389
|
+ 0, 304, 305, 306, 0, 0, 307, 308, 309, 310,
|
|
390
|
+ 311, 0, 312, 0, 0, 313, 0, 0, 314, 315,
|
|
391
|
+ 0, 0, 316, 317, 318, 0, 0, 0, 158, 155,
|
|
392
|
+ 163, 319, 320, 321, 322, 323, 324, 325, 0, 0,
|
|
393
|
+
|
|
394
|
+ 326, 150, 164, 169, 327, 328, 329, 330, 331, 332,
|
|
395
|
+ 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
|
|
396
|
+ 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,
|
|
397
|
+ 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
|
|
398
|
+ 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
|
|
399
|
+
|
|
400
|
+ 373, 374, 375, 376, 377, 378
|
412
|
401
|
]
|
413
|
402
|
|
414
|
|
-
|
415
|
403
|
# This data has been taken literally from the files `glyphlist.txt'
|
416
|
404
|
# and `zapfdingbats.txt' version 2.0, Sept 2002. It is available from
|
417
|
405
|
#
|
... |
... |
@@ -4906,81 +4894,81 @@ a9;2720 |
4906
|
4894
|
# string table management
|
4907
|
4895
|
#
|
4908
|
4896
|
class StringTable:
|
4909
|
|
- def __init__( self, name_list, master_table_name ):
|
4910
|
|
- self.names = name_list
|
4911
|
|
- self.master_table = master_table_name
|
4912
|
|
- self.indices = {}
|
4913
|
|
- index = 0
|
4914
|
|
-
|
4915
|
|
- for name in name_list:
|
4916
|
|
- self.indices[name] = index
|
4917
|
|
- index += len( name ) + 1
|
4918
|
|
-
|
4919
|
|
- self.total = index
|
4920
|
|
-
|
4921
|
|
- def dump( self, file ):
|
4922
|
|
- write = file.write
|
4923
|
|
- write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
|
4924
|
|
- write( "#ifdef __cplusplus\n" )
|
4925
|
|
- write( ' extern "C"\n' )
|
4926
|
|
- write( "#else\n" )
|
4927
|
|
- write( " extern\n" )
|
4928
|
|
- write( "#endif\n" )
|
4929
|
|
- write( "#endif\n" )
|
4930
|
|
- write( " const char " + self.master_table +
|
4931
|
|
- "[" + repr( self.total ) + "]\n" )
|
4932
|
|
- write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
|
4933
|
|
- write( " =\n" )
|
4934
|
|
- write( " {\n" )
|
4935
|
|
-
|
4936
|
|
- line = ""
|
4937
|
|
- for name in self.names:
|
4938
|
|
- line += " '"
|
4939
|
|
- line += string.join( ( re.findall( ".", name ) ), "','" )
|
4940
|
|
- line += "', 0,\n"
|
4941
|
|
-
|
4942
|
|
- write( line )
|
4943
|
|
- write( " }\n" )
|
4944
|
|
- write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
|
4945
|
|
- write( " ;\n\n\n" )
|
4946
|
|
-
|
4947
|
|
- def dump_sublist( self, file, table_name, macro_name, sublist ):
|
4948
|
|
- write = file.write
|
4949
|
|
- write( "#define " + macro_name + " " + repr( len( sublist ) ) + "\n\n" )
|
4950
|
|
-
|
4951
|
|
- write( " /* Values are offsets into the `" +
|
4952
|
|
- self.master_table + "' table */\n\n" )
|
4953
|
|
- write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
|
4954
|
|
- write( "#ifdef __cplusplus\n" )
|
4955
|
|
- write( ' extern "C"\n' )
|
4956
|
|
- write( "#else\n" )
|
4957
|
|
- write( " extern\n" )
|
4958
|
|
- write( "#endif\n" )
|
4959
|
|
- write( "#endif\n" )
|
4960
|
|
- write( " const short " + table_name +
|
4961
|
|
- "[" + macro_name + "]\n" )
|
4962
|
|
- write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
|
4963
|
|
- write( " =\n" )
|
4964
|
|
- write( " {\n" )
|
4965
|
|
-
|
4966
|
|
- line = " "
|
4967
|
|
- comma = ""
|
4968
|
|
- col = 0
|
4969
|
|
-
|
4970
|
|
- for name in sublist:
|
4971
|
|
- line += comma
|
4972
|
|
- line += "%4d" % self.indices[name]
|
4973
|
|
- col += 1
|
4974
|
|
- comma = ","
|
4975
|
|
- if col == 14:
|
4976
|
|
- col = 0
|
4977
|
|
- comma = ",\n "
|
4978
|
|
-
|
4979
|
|
- write( line )
|
4980
|
|
- write( "\n" )
|
4981
|
|
- write( " }\n" )
|
4982
|
|
- write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
|
4983
|
|
- write( " ;\n\n\n" )
|
|
4897
|
+ def __init__(self, name_list, master_table_name):
|
|
4898
|
+ self.names = name_list
|
|
4899
|
+ self.master_table = master_table_name
|
|
4900
|
+ self.indices = {}
|
|
4901
|
+ index = 0
|
|
4902
|
+
|
|
4903
|
+ for name in name_list:
|
|
4904
|
+ self.indices[name] = index
|
|
4905
|
+ index += len(name) + 1
|
|
4906
|
+
|
|
4907
|
+ self.total = index
|
|
4908
|
+
|
|
4909
|
+ def dump(self, file):
|
|
4910
|
+ write = file.write
|
|
4911
|
+ write("#ifndef DEFINE_PS_TABLES_DATA\n")
|
|
4912
|
+ write("#ifdef __cplusplus\n")
|
|
4913
|
+ write(' extern "C"\n')
|
|
4914
|
+ write("#else\n")
|
|
4915
|
+ write(" extern\n")
|
|
4916
|
+ write("#endif\n")
|
|
4917
|
+ write("#endif\n")
|
|
4918
|
+ write(" const char " + self.master_table +
|
|
4919
|
+ "[" + repr(self.total) + "]\n")
|
|
4920
|
+ write("#ifdef DEFINE_PS_TABLES_DATA\n")
|
|
4921
|
+ write(" =\n")
|
|
4922
|
+ write(" {\n")
|
|
4923
|
+
|
|
4924
|
+ line = ""
|
|
4925
|
+ for name in self.names:
|
|
4926
|
+ line += " '"
|
|
4927
|
+ line += "','".join(list(name))
|
|
4928
|
+ line += "', 0,\n"
|
|
4929
|
+
|
|
4930
|
+ write(line)
|
|
4931
|
+ write(" }\n")
|
|
4932
|
+ write("#endif /* DEFINE_PS_TABLES_DATA */\n")
|
|
4933
|
+ write(" ;\n\n\n")
|
|
4934
|
+
|
|
4935
|
+ def dump_sublist(self, file, table_name, macro_name, sublist):
|
|
4936
|
+ write = file.write
|
|
4937
|
+ write("#define " + macro_name + " " + repr(len(sublist)) + "\n\n")
|
|
4938
|
+
|
|
4939
|
+ write(" /* Values are offsets into the `" +
|
|
4940
|
+ self.master_table + "' table */\n\n")
|
|
4941
|
+ write("#ifndef DEFINE_PS_TABLES_DATA\n")
|
|
4942
|
+ write("#ifdef __cplusplus\n")
|
|
4943
|
+ write(' extern "C"\n')
|
|
4944
|
+ write("#else\n")
|
|
4945
|
+ write(" extern\n")
|
|
4946
|
+ write("#endif\n")
|
|
4947
|
+ write("#endif\n")
|
|
4948
|
+ write(" const short " + table_name +
|
|
4949
|
+ "[" + macro_name + "]\n")
|
|
4950
|
+ write("#ifdef DEFINE_PS_TABLES_DATA\n")
|
|
4951
|
+ write(" =\n")
|
|
4952
|
+ write(" {\n")
|
|
4953
|
+
|
|
4954
|
+ line = " "
|
|
4955
|
+ comma = ""
|
|
4956
|
+ col = 0
|
|
4957
|
+
|
|
4958
|
+ for name in sublist:
|
|
4959
|
+ line += comma
|
|
4960
|
+ line += "%4d" % self.indices[name]
|
|
4961
|
+ col += 1
|
|
4962
|
+ comma = ","
|
|
4963
|
+ if col == 14:
|
|
4964
|
+ col = 0
|
|
4965
|
+ comma = ",\n "
|
|
4966
|
+
|
|
4967
|
+ write(line)
|
|
4968
|
+ write("\n")
|
|
4969
|
+ write(" }\n")
|
|
4970
|
+ write("#endif /* DEFINE_PS_TABLES_DATA */\n")
|
|
4971
|
+ write(" ;\n\n\n")
|
4984
|
4972
|
|
4985
|
4973
|
|
4986
|
4974
|
# We now store the Adobe Glyph List in compressed form. The list is put
|
... |
... |
@@ -5059,307 +5047,312 @@ class StringTable: |
5059
|
5047
|
# The root node has first letter = 0, and no value.
|
5060
|
5048
|
#
|
5061
|
5049
|
class StringNode:
|
5062
|
|
- def __init__( self, letter, value ):
|
5063
|
|
- self.letter = letter
|
5064
|
|
- self.value = value
|
5065
|
|
- self.children = {}
|
5066
|
|
-
|
5067
|
|
- def __cmp__( self, other ):
|
5068
|
|
- return ord( self.letter[0] ) - ord( other.letter[0] )
|
5069
|
|
-
|
5070
|
|
- def add( self, word, value ):
|
5071
|
|
- if len( word ) == 0:
|
5072
|
|
- self.value = value
|
5073
|
|
- return
|
5074
|
|
-
|
5075
|
|
- letter = word[0]
|
5076
|
|
- word = word[1:]
|
|
5050
|
+ def __init__(self, letter, value):
|
|
5051
|
+ self.letter = letter
|
|
5052
|
+ self.value = value
|
|
5053
|
+ self.children = {}
|
|
5054
|
+
|
|
5055
|
+ def __cmp__(self, other):
|
|
5056
|
+ return ord(self.letter[0]) - ord(other.letter[0])
|
|
5057
|
+
|
|
5058
|
+ def __lt__(self, other):
|
|
5059
|
+ return self.letter[0] < other.letter[0]
|
|
5060
|
+
|
|
5061
|
+ def add(self, word, value):
|
|
5062
|
+ if len(word) == 0:
|
|
5063
|
+ self.value = value
|
|
5064
|
+ return
|
|
5065
|
+
|
|
5066
|
+ letter = word[0]
|
|
5067
|
+ word = word[1:]
|
5077
|
5068
|
|
5078
|
|
- if self.children.has_key( letter ):
|
5079
|
|
- child = self.children[letter]
|
5080
|
|
- else:
|
5081
|
|
- child = StringNode( letter, 0 )
|
5082
|
|
- self.children[letter] = child
|
|
5069
|
+ if letter in self.children:
|
|
5070
|
+ child = self.children[letter]
|
|
5071
|
+ else:
|
|
5072
|
+ child = StringNode(letter, 0)
|
|
5073
|
+ self.children[letter] = child
|
5083
|
5074
|
|
5084
|
|
- child.add( word, value )
|
|
5075
|
+ child.add(word, value)
|
5085
|
5076
|
|
5086
|
|
- def optimize( self ):
|
5087
|
|
- # optimize all children first
|
5088
|
|
- children = self.children.values()
|
5089
|
|
- self.children = {}
|
|
5077
|
+ def optimize(self):
|
|
5078
|
+ # optimize all children first
|
|
5079
|
+ children = list(self.children.values())
|
|
5080
|
+ self.children = {}
|
5090
|
5081
|
|
5091
|
|
- for child in children:
|
5092
|
|
- self.children[child.letter[0]] = child.optimize()
|
|
5082
|
+ for child in children:
|
|
5083
|
+ self.children[child.letter[0]] = child.optimize()
|
5093
|
5084
|
|
5094
|
|
- # don't optimize if there's a value,
|
5095
|
|
- # if we don't have any child or if we
|
5096
|
|
- # have more than one child
|
5097
|
|
- if ( self.value != 0 ) or ( not children ) or len( children ) > 1:
|
5098
|
|
- return self
|
|
5085
|
+ # don't optimize if there's a value,
|
|
5086
|
+ # if we don't have any child or if we
|
|
5087
|
+ # have more than one child
|
|
5088
|
+ if (self.value != 0) or (not children) or len(children) > 1:
|
|
5089
|
+ return self
|
5099
|
5090
|
|
5100
|
|
- child = children[0]
|
|
5091
|
+ child = children[0]
|
5101
|
5092
|
|
5102
|
|
- self.letter += child.letter
|
5103
|
|
- self.value = child.value
|
5104
|
|
- self.children = child.children
|
|
5093
|
+ self.letter += child.letter
|
|
5094
|
+ self.value = child.value
|
|
5095
|
+ self.children = child.children
|
5105
|
5096
|
|
5106
|
|
- return self
|
|
5097
|
+ return self
|
5107
|
5098
|
|
5108
|
|
- def dump_debug( self, write, margin ):
|
5109
|
|
- # this is used during debugging
|
5110
|
|
- line = margin + "+-"
|
5111
|
|
- if len( self.letter ) == 0:
|
5112
|
|
- line += "<NOLETTER>"
|
5113
|
|
- else:
|
5114
|
|
- line += self.letter
|
|
5099
|
+ def dump_debug(self, write, margin):
|
|
5100
|
+ # this is used during debugging
|
|
5101
|
+ line = margin + "+-"
|
|
5102
|
+ if len(self.letter) == 0:
|
|
5103
|
+ line += "<NOLETTER>"
|
|
5104
|
+ else:
|
|
5105
|
+ line += self.letter
|
5115
|
5106
|
|
5116
|
|
- if self.value:
|
5117
|
|
- line += " => " + repr( self.value )
|
|
5107
|
+ if self.value:
|
|
5108
|
+ line += " => " + repr(self.value)
|
5118
|
5109
|
|
5119
|
|
- write( line + "\n" )
|
|
5110
|
+ write(line + "\n")
|
5120
|
5111
|
|
5121
|
|
- if self.children:
|
5122
|
|
- margin += "| "
|
5123
|
|
- for child in self.children.values():
|
5124
|
|
- child.dump_debug( write, margin )
|
|
5112
|
+ if self.children:
|
|
5113
|
+ margin += "| "
|
|
5114
|
+ for child in self.children.values():
|
|
5115
|
+ child.dump_debug(write, margin)
|
5125
|
5116
|
|
5126
|
|
- def locate( self, index ):
|
5127
|
|
- self.index = index
|
5128
|
|
- if len( self.letter ) > 0:
|
5129
|
|
- index += len( self.letter ) + 1
|
5130
|
|
- else:
|
5131
|
|
- index += 2
|
|
5117
|
+ def locate(self, index):
|
|
5118
|
+ self.index = index
|
|
5119
|
+ if len(self.letter) > 0:
|
|
5120
|
+ index += len(self.letter) + 1
|
|
5121
|
+ else:
|
|
5122
|
+ index += 2
|
5132
|
5123
|
|
5133
|
|
- if self.value != 0:
|
5134
|
|
- index += 2
|
|
5124
|
+ if self.value != 0:
|
|
5125
|
+ index += 2
|
5135
|
5126
|
|
5136
|
|
- children = self.children.values()
|
5137
|
|
- children.sort()
|
|
5127
|
+ children = list(self.children.values())
|
|
5128
|
+ children.sort()
|
5138
|
5129
|
|
5139
|
|
- index += 2 * len( children )
|
5140
|
|
- for child in children:
|
5141
|
|
- index = child.locate( index )
|
|
5130
|
+ index += 2 * len(children)
|
|
5131
|
+ for child in children:
|
|
5132
|
+ index = child.locate(index)
|
5142
|
5133
|
|
5143
|
|
- return index
|
|
5134
|
+ return index
|
5144
|
5135
|
|
5145
|
|
- def store( self, storage ):
|
5146
|
|
- # write the letters
|
5147
|
|
- l = len( self.letter )
|
5148
|
|
- if l == 0:
|
5149
|
|
- storage += struct.pack( "B", 0 )
|
5150
|
|
- else:
|
5151
|
|
- for n in range( l ):
|
5152
|
|
- val = ord( self.letter[n] )
|
5153
|
|
- if n < l - 1:
|
5154
|
|
- val += 128
|
5155
|
|
- storage += struct.pack( "B", val )
|
|
5136
|
+ def store(self, storage):
|
|
5137
|
+ # write the letters
|
|
5138
|
+ length = len(self.letter)
|
|
5139
|
+ if length == 0:
|
|
5140
|
+ storage += struct.pack("B", 0)
|
|
5141
|
+ else:
|
|
5142
|
+ for n in range(length):
|
|
5143
|
+ val = ord(self.letter[n])
|
|
5144
|
+ if n < length - 1:
|
|
5145
|
+ val += 128
|
|
5146
|
+ storage += struct.pack("B", val)
|
5156
|
5147
|
|
5157
|
|
- # write the count
|
5158
|
|
- children = self.children.values()
|
5159
|
|
- children.sort()
|
|
5148
|
+ # write the count
|
|
5149
|
+ children = list(self.children.values())
|
|
5150
|
+ children.sort()
|
5160
|
5151
|
|
5161
|
|
- count = len( children )
|
|
5152
|
+ count = len(children)
|
5162
|
5153
|
|
5163
|
|
- if self.value != 0:
|
5164
|
|
- storage += struct.pack( "!BH", count + 128, self.value )
|
5165
|
|
- else:
|
5166
|
|
- storage += struct.pack( "B", count )
|
|
5154
|
+ if self.value != 0:
|
|
5155
|
+ storage += struct.pack("!BH", count + 128, self.value)
|
|
5156
|
+ else:
|
|
5157
|
+ storage += struct.pack("B", count)
|
5167
|
5158
|
|
5168
|
|
- for child in children:
|
5169
|
|
- storage += struct.pack( "!H", child.index )
|
|
5159
|
+ for child in children:
|
|
5160
|
+ storage += struct.pack("!H", child.index)
|
5170
|
5161
|
|
5171
|
|
- for child in children:
|
5172
|
|
- storage = child.store( storage )
|
|
5162
|
+ for child in children:
|
|
5163
|
+ storage = child.store(storage)
|
5173
|
5164
|
|
5174
|
|
- return storage
|
|
5165
|
+ return storage
|
5175
|
5166
|
|
5176
|
5167
|
|
5177
|
5168
|
def adobe_glyph_values():
|
5178
|
|
- """return the list of glyph names and their unicode values"""
|
5179
|
|
-
|
5180
|
|
- lines = string.split( adobe_glyph_list, '\n' )
|
5181
|
|
- glyphs = []
|
5182
|
|
- values = []
|
5183
|
|
-
|
5184
|
|
- for line in lines:
|
5185
|
|
- if line:
|
5186
|
|
- fields = string.split( line, ';' )
|
5187
|
|
-# print fields[1] + ' - ' + fields[0]
|
5188
|
|
- subfields = string.split( fields[1], ' ' )
|
5189
|
|
- if len( subfields ) == 1:
|
5190
|
|
- glyphs.append( fields[0] )
|
5191
|
|
- values.append( fields[1] )
|
5192
|
|
-
|
5193
|
|
- return glyphs, values
|
5194
|
|
-
|
5195
|
|
-
|
5196
|
|
-def filter_glyph_names( alist, filter ):
|
5197
|
|
- """filter `alist' by taking _out_ all glyph names that are in `filter'"""
|
5198
|
|
-
|
5199
|
|
- count = 0
|
5200
|
|
- extras = []
|
5201
|
|
-
|
5202
|
|
- for name in alist:
|
5203
|
|
- try:
|
5204
|
|
- filtered_index = filter.index( name )
|
5205
|
|
- except:
|
5206
|
|
- extras.append( name )
|
5207
|
|
-
|
5208
|
|
- return extras
|
5209
|
|
-
|
5210
|
|
-
|
5211
|
|
-def dump_encoding( file, encoding_name, encoding_list ):
|
5212
|
|
- """dump a given encoding"""
|
5213
|
|
-
|
5214
|
|
- write = file.write
|
5215
|
|
- write( " /* the following are indices into the SID name table */\n" )
|
5216
|
|
- write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
|
5217
|
|
- write( "#ifdef __cplusplus\n" )
|
5218
|
|
- write( ' extern "C"\n' )
|
5219
|
|
- write( "#else\n" )
|
5220
|
|
- write( " extern\n" )
|
5221
|
|
- write( "#endif\n" )
|
5222
|
|
- write( "#endif\n" )
|
5223
|
|
- write( " const unsigned short " + encoding_name +
|
5224
|
|
- "[" + repr( len( encoding_list ) ) + "]\n" )
|
5225
|
|
- write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
|
5226
|
|
- write( " =\n" )
|
5227
|
|
- write( " {\n" )
|
5228
|
|
-
|
5229
|
|
- line = " "
|
5230
|
|
- comma = ""
|
5231
|
|
- col = 0
|
5232
|
|
- for value in encoding_list:
|
5233
|
|
- line += comma
|
5234
|
|
- line += "%3d" % value
|
5235
|
|
- comma = ","
|
5236
|
|
- col += 1
|
5237
|
|
- if col == 16:
|
5238
|
|
- col = 0
|
5239
|
|
- comma = ",\n "
|
5240
|
|
-
|
5241
|
|
- write( line )
|
5242
|
|
- write( "\n" )
|
5243
|
|
- write( " }\n" )
|
5244
|
|
- write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
|
5245
|
|
- write( " ;\n\n\n" )
|
5246
|
|
-
|
5247
|
|
-
|
5248
|
|
-def dump_array( the_array, write, array_name ):
|
5249
|
|
- """dumps a given encoding"""
|
5250
|
|
-
|
5251
|
|
- write( "#ifndef DEFINE_PS_TABLES_DATA\n" )
|
5252
|
|
- write( "#ifdef __cplusplus\n" )
|
5253
|
|
- write( ' extern "C"\n' )
|
5254
|
|
- write( "#else\n" )
|
5255
|
|
- write( " extern\n" )
|
5256
|
|
- write( "#endif\n" )
|
5257
|
|
- write( "#endif\n" )
|
5258
|
|
- write( " const unsigned char " + array_name +
|
5259
|
|
- "[" + repr( len( the_array ) ) + "L]\n" )
|
5260
|
|
- write( "#ifdef DEFINE_PS_TABLES_DATA\n" )
|
5261
|
|
- write( " =\n" )
|
5262
|
|
- write( " {\n" )
|
5263
|
|
-
|
5264
|
|
- line = ""
|
5265
|
|
- comma = " "
|
5266
|
|
- col = 0
|
5267
|
|
-
|
5268
|
|
- for value in the_array:
|
5269
|
|
- line += comma
|
5270
|
|
- line += "%3d" % ord( value )
|
5271
|
|
- comma = ","
|
5272
|
|
- col += 1
|
5273
|
|
-
|
5274
|
|
- if col == 16:
|
5275
|
|
- col = 0
|
5276
|
|
- comma = ",\n "
|
5277
|
|
-
|
5278
|
|
- if len( line ) > 1024:
|
5279
|
|
- write( line )
|
5280
|
|
- line = ""
|
5281
|
|
-
|
5282
|
|
- write( line )
|
5283
|
|
- write( "\n" )
|
5284
|
|
- write( " }\n" )
|
5285
|
|
- write( "#endif /* DEFINE_PS_TABLES_DATA */\n" )
|
5286
|
|
- write( " ;\n\n\n" )
|
|
5169
|
+ """return the list of glyph names and their unicode values"""
|
|
5170
|
+
|
|
5171
|
+ lines = adobe_glyph_list.split("\n")
|
|
5172
|
+ glyphs = []
|
|
5173
|
+ values = []
|
|
5174
|
+
|
|
5175
|
+ for line in lines:
|
|
5176
|
+ if line:
|
|
5177
|
+ fields = line.split(';')
|
|
5178
|
+ # print fields[1] + ' - ' + fields[0]
|
|
5179
|
+ subfields = fields[1].split(' ')
|
|
5180
|
+ if len(subfields) == 1:
|
|
5181
|
+ glyphs.append(fields[0])
|
|
5182
|
+ values.append(fields[1])
|
|
5183
|
+
|
|
5184
|
+ return glyphs, values
|
|
5185
|
+
|
|
5186
|
+
|
|
5187
|
+def filter_glyph_names(alist, filter):
|
|
5188
|
+ """filter `alist' by taking _out_ all glyph names that are in `filter'"""
|
|
5189
|
+
|
|
5190
|
+ count = 0
|
|
5191
|
+ extras = []
|
|
5192
|
+
|
|
5193
|
+ for name in alist:
|
|
5194
|
+ try:
|
|
5195
|
+ filtered_index = filter.index(name)
|
|
5196
|
+ except:
|
|
5197
|
+ extras.append(name)
|
|
5198
|
+
|
|
5199
|
+ return extras
|
|
5200
|
+
|
|
5201
|
+
|
|
5202
|
+def dump_encoding(file, encoding_name, encoding_list):
|
|
5203
|
+ """dump a given encoding"""
|
|
5204
|
+
|
|
5205
|
+ write = file.write
|
|
5206
|
+ write(" /* the following are indices into the SID name table */\n")
|
|
5207
|
+ write("#ifndef DEFINE_PS_TABLES_DATA\n")
|
|
5208
|
+ write("#ifdef __cplusplus\n")
|
|
5209
|
+ write(' extern "C"\n')
|
|
5210
|
+ write("#else\n")
|
|
5211
|
+ write(" extern\n")
|
|
5212
|
+ write("#endif\n")
|
|
5213
|
+ write("#endif\n")
|
|
5214
|
+ write(" const unsigned short " + encoding_name +
|
|
5215
|
+ "[" + repr(len(encoding_list)) + "]\n")
|
|
5216
|
+ write("#ifdef DEFINE_PS_TABLES_DATA\n")
|
|
5217
|
+ write(" =\n")
|
|
5218
|
+ write(" {\n")
|
|
5219
|
+
|
|
5220
|
+ line = " "
|
|
5221
|
+ comma = ""
|
|
5222
|
+ col = 0
|
|
5223
|
+ for value in encoding_list:
|
|
5224
|
+ line += comma
|
|
5225
|
+ line += "%3d" % value
|
|
5226
|
+ comma = ","
|
|
5227
|
+ col += 1
|
|
5228
|
+ if col == 16:
|
|
5229
|
+ col = 0
|
|
5230
|
+ comma = ",\n "
|
|
5231
|
+
|
|
5232
|
+ write(line)
|
|
5233
|
+ write("\n")
|
|
5234
|
+ write(" }\n")
|
|
5235
|
+ write("#endif /* DEFINE_PS_TABLES_DATA */\n")
|
|
5236
|
+ write(" ;\n\n\n")
|
|
5237
|
+
|
|
5238
|
+
|
|
5239
|
+def dump_array(the_array, write, array_name):
|
|
5240
|
+ """dumps a given encoding"""
|
|
5241
|
+
|
|
5242
|
+ write("#ifndef DEFINE_PS_TABLES_DATA\n")
|
|
5243
|
+ write("#ifdef __cplusplus\n")
|
|
5244
|
+ write(' extern "C"\n')
|
|
5245
|
+ write("#else\n")
|
|
5246
|
+ write(" extern\n")
|
|
5247
|
+ write("#endif\n")
|
|
5248
|
+ write("#endif\n")
|
|
5249
|
+ write(" const unsigned char " + array_name +
|
|
5250
|
+ "[" + repr(len(the_array)) + "L]\n")
|
|
5251
|
+ write("#ifdef DEFINE_PS_TABLES_DATA\n")
|
|
5252
|
+ write(" =\n")
|
|
5253
|
+ write(" {\n")
|
|
5254
|
+
|
|
5255
|
+ line = ""
|
|
5256
|
+ comma = " "
|
|
5257
|
+ col = 0
|
|
5258
|
+
|
|
5259
|
+ for value in the_array:
|
|
5260
|
+ line += comma
|
|
5261
|
+ line += "%3d" % value
|
|
5262
|
+ comma = ","
|
|
5263
|
+ col += 1
|
|
5264
|
+
|
|
5265
|
+ if col == 16:
|
|
5266
|
+ col = 0
|
|
5267
|
+ comma = ",\n "
|
|
5268
|
+
|
|
5269
|
+ if len(line) > 1024:
|
|
5270
|
+ write(line)
|
|
5271
|
+ line = ""
|
|
5272
|
+
|
|
5273
|
+ write(line)
|
|
5274
|
+ write("\n")
|
|
5275
|
+ write(" }\n")
|
|
5276
|
+ write("#endif /* DEFINE_PS_TABLES_DATA */\n")
|
|
5277
|
+ write(" ;\n\n\n")
|
5287
|
5278
|
|
5288
|
5279
|
|
5289
|
5280
|
def main():
|
5290
|
|
- """main program body"""
|
5291
|
|
-
|
5292
|
|
- if len( sys.argv ) != 2:
|
5293
|
|
- print __doc__ % sys.argv[0]
|
5294
|
|
- sys.exit( 1 )
|
5295
|
|
-
|
5296
|
|
- file = open( sys.argv[1], "wb" )
|
5297
|
|
- write = file.write
|
5298
|
|
-
|
5299
|
|
- count_sid = len( sid_standard_names )
|
5300
|
|
-
|
5301
|
|
- # `mac_extras' contains the list of glyph names in the Macintosh standard
|
5302
|
|
- # encoding which are not in the SID Standard Names.
|
5303
|
|
- #
|
5304
|
|
- mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names )
|
5305
|
|
-
|
5306
|
|
- # `base_list' contains the names of our final glyph names table.
|
5307
|
|
- # It consists of the `mac_extras' glyph names, followed by the SID
|
5308
|
|
- # standard names.
|
5309
|
|
- #
|
5310
|
|
- mac_extras_count = len( mac_extras )
|
5311
|
|
- base_list = mac_extras + sid_standard_names
|
5312
|
|
-
|
5313
|
|
- write( "/****************************************************************************\n" )
|
5314
|
|
- write( " *\n" )
|
5315
|
|
-
|
5316
|
|
- write( " * %-71s\n" % os.path.basename( sys.argv[1] ) )
|
5317
|
|
-
|
5318
|
|
- write( " *\n" )
|
5319
|
|
- write( " * PostScript glyph names.\n" )
|
5320
|
|
- write( " *\n" )
|
5321
|
|
- write( " * Copyright 2005-2019 by\n" )
|
5322
|
|
- write( " * David Turner, Robert Wilhelm, and Werner Lemberg.\n" )
|
5323
|
|
- write( " *\n" )
|
5324
|
|
- write( " * This file is part of the FreeType project, and may only be used,\n" )
|
5325
|
|
- write( " * modified, and distributed under the terms of the FreeType project\n" )
|
5326
|
|
- write( " * license, LICENSE.TXT. By continuing to use, modify, or distribute\n" )
|
5327
|
|
- write( " * this file you indicate that you have read the license and\n" )
|
5328
|
|
- write( " * understand and accept it fully.\n" )
|
5329
|
|
- write( " *\n" )
|
5330
|
|
- write( " */\n" )
|
5331
|
|
- write( "\n" )
|
5332
|
|
- write( "\n" )
|
5333
|
|
- write( " /* This file has been generated automatically -- do not edit! */\n" )
|
5334
|
|
- write( "\n" )
|
5335
|
|
- write( "\n" )
|
5336
|
|
-
|
5337
|
|
- # dump final glyph list (mac extras + sid standard names)
|
5338
|
|
- #
|
5339
|
|
- st = StringTable( base_list, "ft_standard_glyph_names" )
|
5340
|
|
-
|
5341
|
|
- st.dump( file )
|
5342
|
|
- st.dump_sublist( file, "ft_mac_names",
|
5343
|
|
- "FT_NUM_MAC_NAMES", mac_standard_names )
|
5344
|
|
- st.dump_sublist( file, "ft_sid_names",
|
5345
|
|
- "FT_NUM_SID_NAMES", sid_standard_names )
|
5346
|
|
-
|
5347
|
|
- dump_encoding( file, "t1_standard_encoding", t1_standard_encoding )
|
5348
|
|
- dump_encoding( file, "t1_expert_encoding", t1_expert_encoding )
|
5349
|
|
-
|
5350
|
|
- # dump the AGL in its compressed form
|
5351
|
|
- #
|
5352
|
|
- agl_glyphs, agl_values = adobe_glyph_values()
|
5353
|
|
- dict = StringNode( "", 0 )
|
5354
|
|
-
|
5355
|
|
- for g in range( len( agl_glyphs ) ):
|
5356
|
|
- dict.add( agl_glyphs[g], eval( "0x" + agl_values[g] ) )
|
5357
|
|
-
|
5358
|
|
- dict = dict.optimize()
|
5359
|
|
- dict_len = dict.locate( 0 )
|
5360
|
|
- dict_array = dict.store( "" )
|
5361
|
|
-
|
5362
|
|
- write( """\
|
|
5281
|
+ """main program body"""
|
|
5282
|
+
|
|
5283
|
+ if len(sys.argv) != 2:
|
|
5284
|
+ print(__doc__ % sys.argv[0])
|
|
5285
|
+ sys.exit(1)
|
|
5286
|
+
|
|
5287
|
+ file = open(sys.argv[1], "w")
|
|
5288
|
+ write = file.write
|
|
5289
|
+
|
|
5290
|
+ count_sid = len(sid_standard_names)
|
|
5291
|
+
|
|
5292
|
+ # `mac_extras' contains the list of glyph names in the Macintosh standard
|
|
5293
|
+ # encoding which are not in the SID Standard Names.
|
|
5294
|
+ #
|
|
5295
|
+ mac_extras = filter_glyph_names(mac_standard_names, sid_standard_names)
|
|
5296
|
+
|
|
5297
|
+ # `base_list' contains the names of our final glyph names table.
|
|
5298
|
+ # It consists of the `mac_extras' glyph names, followed by the SID
|
|
5299
|
+ # standard names.
|
|
5300
|
+ #
|
|
5301
|
+ mac_extras_count = len(mac_extras)
|
|
5302
|
+ base_list = mac_extras + sid_standard_names
|
|
5303
|
+
|
|
5304
|
+ write("/*\n")
|
|
5305
|
+ write(" *\n")
|
|
5306
|
+ write(" * %-71s\n" % os.path.basename(sys.argv[1]))
|
|
5307
|
+ write(" *\n")
|
|
5308
|
+ write(" * PostScript glyph names.\n")
|
|
5309
|
+ write(" *\n")
|
|
5310
|
+ write(" * Copyright 2005-2022 by\n")
|
|
5311
|
+ write(" * David Turner, Robert Wilhelm, and Werner Lemberg.\n")
|
|
5312
|
+ write(" *\n")
|
|
5313
|
+ write(" * This file is part of the FreeType project, and may only be "
|
|
5314
|
+ "used,\n")
|
|
5315
|
+ write(" * modified, and distributed under the terms of the FreeType "
|
|
5316
|
+ "project\n")
|
|
5317
|
+ write(" * license, LICENSE.TXT. By continuing to use, modify, or "
|
|
5318
|
+ "distribute\n")
|
|
5319
|
+ write(" * this file you indicate that you have read the license and\n")
|
|
5320
|
+ write(" * understand and accept it fully.\n")
|
|
5321
|
+ write(" *\n")
|
|
5322
|
+ write(" */\n")
|
|
5323
|
+ write("\n")
|
|
5324
|
+ write("\n")
|
|
5325
|
+ write(" /* This file has been generated automatically -- do not edit! */"
|
|
5326
|
+ "\n")
|
|
5327
|
+ write("\n")
|
|
5328
|
+ write("\n")
|
|
5329
|
+
|
|
5330
|
+ # dump final glyph list (mac extras + sid standard names)
|
|
5331
|
+ #
|
|
5332
|
+ st = StringTable(base_list, "ft_standard_glyph_names")
|
|
5333
|
+
|
|
5334
|
+ st.dump(file)
|
|
5335
|
+ st.dump_sublist(file, "ft_mac_names",
|
|
5336
|
+ "FT_NUM_MAC_NAMES", mac_standard_names)
|
|
5337
|
+ st.dump_sublist(file, "ft_sid_names",
|
|
5338
|
+ "FT_NUM_SID_NAMES", sid_standard_names)
|
|
5339
|
+
|
|
5340
|
+ dump_encoding(file, "t1_standard_encoding", t1_standard_encoding)
|
|
5341
|
+ dump_encoding(file, "t1_expert_encoding", t1_expert_encoding)
|
|
5342
|
+
|
|
5343
|
+ # dump the AGL in its compressed form
|
|
5344
|
+ #
|
|
5345
|
+ agl_glyphs, agl_values = adobe_glyph_values()
|
|
5346
|
+ dictionary = StringNode("", 0)
|
|
5347
|
+
|
|
5348
|
+ for g in range(len(agl_glyphs)):
|
|
5349
|
+ dictionary.add(agl_glyphs[g], eval("0x" + agl_values[g]))
|
|
5350
|
+
|
|
5351
|
+ dictionary = dictionary.optimize()
|
|
5352
|
+ dict_len = dictionary.locate(0)
|
|
5353
|
+ dict_array = dictionary.store(b"")
|
|
5354
|
+
|
|
5355
|
+ write("""\
|
5363
|
5356
|
/*
|
5364
|
5357
|
* This table is a compressed version of the Adobe Glyph List (AGL),
|
5365
|
5358
|
* optimized for efficient searching. It has been generated by the
|
... |
... |
@@ -5371,13 +5364,13 @@ def main(): |
5371
|
5364
|
|
5372
|
5365
|
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
5373
|
5366
|
|
5374
|
|
-""" )
|
|
5367
|
+""")
|
5375
|
5368
|
|
5376
|
|
- dump_array( dict_array, write, "ft_adobe_glyph_list" )
|
|
5369
|
+ dump_array(dict_array, write, "ft_adobe_glyph_list")
|
5377
|
5370
|
|
5378
|
|
- # write the lookup routine now
|
5379
|
|
- #
|
5380
|
|
- write( """\
|
|
5371
|
+ # write the lookup routine now
|
|
5372
|
+ #
|
|
5373
|
+ write("""\
|
5381
|
5374
|
#ifdef DEFINE_PS_TABLES
|
5382
|
5375
|
/*
|
5383
|
5376
|
* This function searches the compressed table efficiently.
|
... |
... |
@@ -5477,64 +5470,64 @@ def main(): |
5477
|
5470
|
|
5478
|
5471
|
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
|
5479
|
5472
|
|
5480
|
|
-""" )
|
|
5473
|
+""")
|
5481
|
5474
|
|
5482
|
|
- if 0: # generate unit test, or don't
|
5483
|
|
- #
|
5484
|
|
- # now write the unit test to check that everything works OK
|
5485
|
|
- #
|
5486
|
|
- write( "#ifdef TEST\n\n" )
|
|
5475
|
+ if 0: # generate unit test, or don't
|
|
5476
|
+ #
|
|
5477
|
+ # now write the unit test to check that everything works OK
|
|
5478
|
+ #
|
|
5479
|
+ write("#ifdef TEST\n\n")
|
5487
|
5480
|
|
5488
|
|
- write( "static const char* const the_names[] = {\n" )
|
5489
|
|
- for name in agl_glyphs:
|
5490
|
|
- write( ' "' + name + '",\n' )
|
5491
|
|
- write( " 0\n};\n" )
|
|
5481
|
+ write("static const char* const the_names[] = {\n")
|
|
5482
|
+ for name in agl_glyphs:
|
|
5483
|
+ write(' "' + name + '",\n')
|
|
5484
|
+ write(" 0\n};\n")
|
5492
|
5485
|
|
5493
|
|
- write( "static const unsigned long the_values[] = {\n" )
|
5494
|
|
- for val in agl_values:
|
5495
|
|
- write( ' 0x' + val + ',\n' )
|
5496
|
|
- write( " 0\n};\n" )
|
|
5486
|
+ write("static const unsigned long the_values[] = {\n")
|
|
5487
|
+ for val in agl_values:
|
|
5488
|
+ write(' 0x' + val + ',\n')
|
|
5489
|
+ write(" 0\n};\n")
|
5497
|
5490
|
|
5498
|
|
- write( """
|
|
5491
|
+ write("""
|
5499
|
5492
|
#include <stdlib.h>
|
5500
|
5493
|
#include <stdio.h>
|
|
5494
|
+#include <string.h>
|
5501
|
5495
|
|
5502
|
|
- int
|
5503
|
|
- main( void )
|
5504
|
|
- {
|
5505
|
|
- int result = 0;
|
5506
|
|
- const char* const* names = the_names;
|
5507
|
|
- const unsigned long* values = the_values;
|
|
5496
|
+int
|
|
5497
|
+main( void )
|
|
5498
|
+{
|
|
5499
|
+int result = 0;
|
|
5500
|
+const char* const* names = the_names;
|
|
5501
|
+const unsigned long* values = the_values;
|
5508
|
5502
|
|
5509
|
5503
|
|
5510
|
|
- for ( ; *names; names++, values++ )
|
5511
|
|
- {
|
5512
|
|
- const char* name = *names;
|
5513
|
|
- unsigned long reference = *values;
|
5514
|
|
- unsigned long value;
|
|
5504
|
+for ( ; *names; names++, values++ )
|
|
5505
|
+{
|
|
5506
|
+ const char* name = *names;
|
|
5507
|
+ unsigned long reference = *values;
|
|
5508
|
+ unsigned long value;
|
5515
|
5509
|
|
5516
|
5510
|
|
5517
|
|
- value = ft_get_adobe_glyph_index( name, name + strlen( name ) );
|
5518
|
|
- if ( value != reference )
|
5519
|
|
- {
|
5520
|
|
- result = 1;
|
5521
|
|
- fprintf( stderr, "name '%s' => %04x instead of %04x\\n",
|
5522
|
|
- name, value, reference );
|
5523
|
|
- }
|
5524
|
|
- }
|
5525
|
|
-
|
5526
|
|
- return result;
|
|
5511
|
+ value = ft_get_adobe_glyph_index( name, name + strlen( name ) );
|
|
5512
|
+ if ( value != reference )
|
|
5513
|
+ {
|
|
5514
|
+ result = 1;
|
|
5515
|
+ fprintf( stderr, "name '%s' => %04x instead of %04x\\n",
|
|
5516
|
+ name, value, reference );
|
5527
|
5517
|
}
|
5528
|
|
-""" )
|
|
5518
|
+}
|
5529
|
5519
|
|
5530
|
|
- write( "#endif /* TEST */\n" )
|
|
5520
|
+return result;
|
|
5521
|
+}
|
|
5522
|
+""")
|
5531
|
5523
|
|
5532
|
|
- write("\n/* END */\n")
|
|
5524
|
+ write("#endif /* TEST */\n")
|
|
5525
|
+
|
|
5526
|
+ write("\n/* END */\n")
|
5533
|
5527
|
|
5534
|
5528
|
|
5535
|
5529
|
# Now run the main routine
|
5536
|
5530
|
#
|
5537
|
5531
|
main()
|
5538
|
5532
|
|
5539
|
|
-
|
5540
|
5533
|
# END |
|