aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/font-gnu-freefont-python3-compat.patch
blob: 3b21d53b0b9c9b3249034cf196dfd750a7555602 (about) (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
This patch is based off the following patch from Debian.
https://sources.debian.org/data/main/f/fonts-freefont/20120503-10/debian/patches/build_python3_syntax.patch

diff --git a/tools/generate/MacTT b/tools/generate/MacTT
index 30d19e1..f93472f 100755
--- a/tools/generate/MacTT
+++ b/tools/generate/MacTT
@@ -43,7 +43,7 @@ if argc > 1:
 		f = fontforge.open( argv[i] )
 		ttfile = f.fontname + ".mac.ttf"
 		vstr = trim_version_str( f )
-		print "Generating Mac TrueType file ", ttfile, ' ', vstr
+		print("Generating Mac TrueType file ", ttfile, ' ', vstr)
 		f.selection.all()
 		f.autoHint()
 		f.autoInstr()
@@ -51,4 +51,4 @@ if argc > 1:
 		#f.generate( ttfile, flags=('opentype','old-kern') )
 		f.close()
 else:
-	print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
+	print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
diff --git a/tools/generate/OpenType b/tools/generate/OpenType
index 4307231..0ab7987 100755
--- a/tools/generate/OpenType
+++ b/tools/generate/OpenType
@@ -42,7 +42,7 @@ if argc > 1:
 		f = fontforge.open( argv[i] )
 		otfile = f.fontname + ".otf"
 		vstr = trim_version_str( f )
-		print "Generating OpenType file ", otfile, ' ', vstr
+		print("Generating OpenType file ", otfile, ' ', vstr)
 		# Wanted to set to 'UniocdeBmp' if there were no high unicodes
 		# but all attemtps to determine that from Python failed.
 		f.encoding = 'UnicodeFull'
@@ -51,4 +51,4 @@ if argc > 1:
 		f.generate( otfile, flags=('opentype','old-kern','round') )
 		f.close()
 else:
-	print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
+	print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
diff --git a/tools/generate/TrueType b/tools/generate/TrueType
index 1f6cc2f..974c84f 100755
--- a/tools/generate/TrueType
+++ b/tools/generate/TrueType
@@ -42,7 +42,7 @@ if argc > 1:
 		f = fontforge.open( sys.argv[i] )
 		ttfile = f.fontname + ".ttf"
 		vstr = trim_version_str( f )
-		print "Generating TrueType file ", ttfile, ' ', vstr
+		print("Generating TrueType file ", ttfile, ' ', vstr)
 		# Wanted to set to 'UniocdeBmp' if there were no high unicodes
 		# but all attemtps to determine that from Python failed.
 		f.encoding = 'UnicodeFull'
@@ -54,4 +54,4 @@ if argc > 1:
 		f.generate( ttfile, flags=('opentype','old-kern','no-hints') )
 		f.close()
 else:
-	print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
+	print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
diff --git a/tools/generate/WOFF b/tools/generate/WOFF
index 7a3a790..45bff0b 100755
--- a/tools/generate/WOFF
+++ b/tools/generate/WOFF
@@ -153,7 +153,7 @@ if argc > 1:
 		f = fontforge.open( sys.argv[i] )
 		woff_file = f.fontname + ".woff"
 		vstr = trim_version_str( f )
-		print "Generating WOFF file ", woff_file, ' ', vstr
+		print("Generating WOFF file ", woff_file, ' ', vstr)
 		# Wanted to set to 'UniocdeBmp' if there were no high unicodes
 		# but all attemtps to determine that from Python failed.
 		f.encoding = 'UnicodeFull'
@@ -171,4 +171,4 @@ if argc > 1:
 		f.generate( woff_file, flags=('opentype','no-hints') )
 		f.close()
 else:
-	print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
+	print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
diff --git a/tools/test/checkGlyphNumbers.py b/tools/test/checkGlyphNumbers.py
index c845d0d..6540c46 100755
--- a/tools/test/checkGlyphNumbers.py
+++ b/tools/test/checkGlyphNumbers.py
@@ -53,12 +53,12 @@ def isSpecialTrueType( glyph ):
 from os import path
 def checkGlyphNumbers( fontDir, fontFile ):
 	if isinstance( fontFile, ( list, tuple ) ):
-		print "In directory " + fontDir
+		print("In directory " + fontDir)
 		for fontName in fontFile:
 			checkGlyphNumbers( fontDir, fontName )
 		return
 
-	print "Checking slot numbers in " + fontFile
+	print("Checking slot numbers in " + fontFile)
 	font = fontforge.open( path.join( fontDir, fontFile ) )
 
 	g = font.selection.all()
@@ -71,13 +71,13 @@ def checkGlyphNumbers( fontDir, fontFile ):
 			pass
 		elif inPrivateUseRange( glyph ):
 			if glyph.unicode != -1:
-				print "Glyph at slot " + str( glyph.encoding ) \
-					+ " is Private Use but has Unicode"
+				print("Glyph at slot " + str( glyph.encoding ) \
+					+ " is Private Use but has Unicode")
 				problem = True
 		else:
 			if glyph.encoding != glyph.unicode:
-				print "Glyph at slot " + str( glyph.encoding ) \
-					+ " has wrong Unicode"
+				print("Glyph at slot " + str( glyph.encoding ) \
+					+ " has wrong Unicode")
 				problem = True
 
 # --------------------------------------------------------------------------
diff --git a/tools/test/isMonoMono.py b/tools/test/isMonoMono.py
index 0eca9fe..cc35015 100755
--- a/tools/test/isMonoMono.py
+++ b/tools/test/isMonoMono.py
@@ -35,7 +35,7 @@ import sys
 problem = False
 
 def ismonomono( fontfilename ):
-	print "Checking character bounding boxes: " + fontfilename
+	print("Checking character bounding boxes: " + fontfilename)
 	font = fontforge.open( fontfilename )
 
 	g = font.selection.all()
@@ -49,16 +49,16 @@ def ismonomono( fontfilename ):
 				nonzero = e.width
 		else:
 			if e.width > 0 and e.width != nonzero:
-				print '  ' + e.glyphname \
+				print('  ' + e.glyphname \
 					+ '(' + str( e.encoding ) \
 					+ ') width is ' + str( e.width ) \
-					+ ' not ' + str( nonzero )
+					+ ' not ' + str( nonzero ))
 				problem = True
 
 		( xmin, ymin, xmax, ymax ) = e.boundingBox()
 		if ymin < -200 or ymax > 800:
-			print '  ' + e.glyphname + ' goes between heights ' \
-				+ str( ymin )  + ' and ' + str( ymax )
+			print('  ' + e.glyphname + ' goes between heights ' \
+				+ str( ymin )  + ' and ' + str( ymax ))
 	""" 
 	For FontForge handling of TrueType/OpenType magic characters:
 	1) check that 0x0000 0x0001, 0x000D exist and have names
@@ -71,15 +71,15 @@ def ismonomono( fontfilename ):
 	if not font[0x0000] \
 		or font[0x0000].glyphname != '.notdef' \
 		or font[0x0000].width != nonzero:
-		print 'Should be full-width ".notdef" glyph at 0x0000.'
+		print('Should be full-width ".notdef" glyph at 0x0000.')
 	if not font[0x0001] \
 		or font[0x0001].glyphname != '.null' \
 		or font[0x0001].width != 0:
-		print 'Should be zero-width ".null" glyph at 0x0001.'
+		print('Should be zero-width ".null" glyph at 0x0001.')
 	if not font[0x000D] \
 		or font[0x000D].glyphname != 'nonmarkingreturn' \
 		or font[0x000D].width != nonzero:
-		print 'Should be full-width "nonmarkingreturn" glyph at 0x000D.'
+		print('Should be full-width "nonmarkingreturn" glyph at 0x000D.')
 
 scriptname = sys.argv[0];
 argc = len( sys.argv )
diff --git a/tools/test/validate.py b/tools/test/validate.py
index da9ce96..a8b216f 100755
--- a/tools/test/validate.py
+++ b/tools/test/validate.py
@@ -43,7 +43,7 @@ def countPointsInLayer( layer ):
 	return p
 
 def printProblemLine( e, msg ):
-	print "\t" + e.glyphname + msg 
+	print( "\t" + e.glyphname + msg)
 
 def dealWithValidationState( state, e ):
 	if state & 0x2:
@@ -87,7 +87,7 @@ def dealWithValidationState( state, e ):
 def validate( dir, fontFile ):
 	try:
 		font = fontforge.open( dir + fontFile )
-		print "Validating " + fontFile
+		print("Validating " + fontFile)
 
 		g = font.selection.all()
 		g = font.selection.byGlyphs
@@ -98,7 +98,7 @@ def validate( dir, fontFile ):
 			if state != 0:
 				dealWithValidationState( state, e )
 		font.validate
-	except Exception, e:
+	except(Exception, e):
 		problem = True
 		print >> sys.stderr, str( e )