| 1 | This patch is based off the following patch from Debian.
|
| 2 | https://sources.debian.org/data/main/f/fonts-freefont/20120503-10/debian/patches/build_python3_syntax.patch
|
| 3 |
|
| 4 | diff --git a/tools/generate/MacTT b/tools/generate/MacTT
|
| 5 | index 30d19e1..f93472f 100755
|
| 6 | |
| 7 | |
| 8 | @@ -43,7 +43,7 @@ if argc > 1:
|
| 9 | f = fontforge.open( argv[i] )
|
| 10 | ttfile = f.fontname + ".mac.ttf"
|
| 11 | vstr = trim_version_str( f )
|
| 12 | - print "Generating Mac TrueType file ", ttfile, ' ', vstr
|
| 13 | + print("Generating Mac TrueType file ", ttfile, ' ', vstr)
|
| 14 | f.selection.all()
|
| 15 | f.autoHint()
|
| 16 | f.autoInstr()
|
| 17 | @@ -51,4 +51,4 @@ if argc > 1:
|
| 18 | #f.generate( ttfile, flags=('opentype','old-kern') )
|
| 19 | f.close()
|
| 20 | else:
|
| 21 | - print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
|
| 22 | + print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
|
| 23 | diff --git a/tools/generate/OpenType b/tools/generate/OpenType
|
| 24 | index 4307231..0ab7987 100755
|
| 25 | |
| 26 | |
| 27 | @@ -42,7 +42,7 @@ if argc > 1:
|
| 28 | f = fontforge.open( argv[i] )
|
| 29 | otfile = f.fontname + ".otf"
|
| 30 | vstr = trim_version_str( f )
|
| 31 | - print "Generating OpenType file ", otfile, ' ', vstr
|
| 32 | + print("Generating OpenType file ", otfile, ' ', vstr)
|
| 33 | # Wanted to set to 'UniocdeBmp' if there were no high unicodes
|
| 34 | # but all attemtps to determine that from Python failed.
|
| 35 | f.encoding = 'UnicodeFull'
|
| 36 | @@ -51,4 +51,4 @@ if argc > 1:
|
| 37 | f.generate( otfile, flags=('opentype','old-kern','round') )
|
| 38 | f.close()
|
| 39 | else:
|
| 40 | - print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
|
| 41 | + print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
|
| 42 | diff --git a/tools/generate/TrueType b/tools/generate/TrueType
|
| 43 | index 1f6cc2f..974c84f 100755
|
| 44 | |
| 45 | |
| 46 | @@ -42,7 +42,7 @@ if argc > 1:
|
| 47 | f = fontforge.open( sys.argv[i] )
|
| 48 | ttfile = f.fontname + ".ttf"
|
| 49 | vstr = trim_version_str( f )
|
| 50 | - print "Generating TrueType file ", ttfile, ' ', vstr
|
| 51 | + print("Generating TrueType file ", ttfile, ' ', vstr)
|
| 52 | # Wanted to set to 'UniocdeBmp' if there were no high unicodes
|
| 53 | # but all attemtps to determine that from Python failed.
|
| 54 | f.encoding = 'UnicodeFull'
|
| 55 | @@ -54,4 +54,4 @@ if argc > 1:
|
| 56 | f.generate( ttfile, flags=('opentype','old-kern','no-hints') )
|
| 57 | f.close()
|
| 58 | else:
|
| 59 | - print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
|
| 60 | + print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
|
| 61 | diff --git a/tools/generate/WOFF b/tools/generate/WOFF
|
| 62 | index 7a3a790..45bff0b 100755
|
| 63 | |
| 64 | |
| 65 | @@ -153,7 +153,7 @@ if argc > 1:
|
| 66 | f = fontforge.open( sys.argv[i] )
|
| 67 | woff_file = f.fontname + ".woff"
|
| 68 | vstr = trim_version_str( f )
|
| 69 | - print "Generating WOFF file ", woff_file, ' ', vstr
|
| 70 | + print("Generating WOFF file ", woff_file, ' ', vstr)
|
| 71 | # Wanted to set to 'UniocdeBmp' if there were no high unicodes
|
| 72 | # but all attemtps to determine that from Python failed.
|
| 73 | f.encoding = 'UnicodeFull'
|
| 74 | @@ -171,4 +171,4 @@ if argc > 1:
|
| 75 | f.generate( woff_file, flags=('opentype','no-hints') )
|
| 76 | f.close()
|
| 77 | else:
|
| 78 | - print "Usage: " + scriptname + " font.sfd [font.sfd ...]"
|
| 79 | + print("Usage: " + scriptname + " font.sfd [font.sfd ...]")
|
| 80 | diff --git a/tools/test/checkGlyphNumbers.py b/tools/test/checkGlyphNumbers.py
|
| 81 | index c845d0d..6540c46 100755
|
| 82 | |
| 83 | |
| 84 | @@ -53,12 +53,12 @@ def isSpecialTrueType( glyph ):
|
| 85 | from os import path
|
| 86 | def checkGlyphNumbers( fontDir, fontFile ):
|
| 87 | if isinstance( fontFile, ( list, tuple ) ):
|
| 88 | - print "In directory " + fontDir
|
| 89 | + print("In directory " + fontDir)
|
| 90 | for fontName in fontFile:
|
| 91 | checkGlyphNumbers( fontDir, fontName )
|
| 92 | return
|
| 93 |
|
| 94 | - print "Checking slot numbers in " + fontFile
|
| 95 | + print("Checking slot numbers in " + fontFile)
|
| 96 | font = fontforge.open( path.join( fontDir, fontFile ) )
|
| 97 |
|
| 98 | g = font.selection.all()
|
| 99 | @@ -71,13 +71,13 @@ def checkGlyphNumbers( fontDir, fontFile ):
|
| 100 | pass
|
| 101 | elif inPrivateUseRange( glyph ):
|
| 102 | if glyph.unicode != -1:
|
| 103 | - print "Glyph at slot " + str( glyph.encoding ) \
|
| 104 | - + " is Private Use but has Unicode"
|
| 105 | + print("Glyph at slot " + str( glyph.encoding ) \
|
| 106 | + + " is Private Use but has Unicode")
|
| 107 | problem = True
|
| 108 | else:
|
| 109 | if glyph.encoding != glyph.unicode:
|
| 110 | - print "Glyph at slot " + str( glyph.encoding ) \
|
| 111 | - + " has wrong Unicode"
|
| 112 | + print("Glyph at slot " + str( glyph.encoding ) \
|
| 113 | + + " has wrong Unicode")
|
| 114 | problem = True
|
| 115 |
|
| 116 | # --------------------------------------------------------------------------
|
| 117 | diff --git a/tools/test/isMonoMono.py b/tools/test/isMonoMono.py
|
| 118 | index 0eca9fe..cc35015 100755
|
| 119 | |
| 120 | |
| 121 | @@ -35,7 +35,7 @@ import sys
|
| 122 | problem = False
|
| 123 |
|
| 124 | def ismonomono( fontfilename ):
|
| 125 | - print "Checking character bounding boxes: " + fontfilename
|
| 126 | + print("Checking character bounding boxes: " + fontfilename)
|
| 127 | font = fontforge.open( fontfilename )
|
| 128 |
|
| 129 | g = font.selection.all()
|
| 130 | @@ -49,16 +49,16 @@ def ismonomono( fontfilename ):
|
| 131 | nonzero = e.width
|
| 132 | else:
|
| 133 | if e.width > 0 and e.width != nonzero:
|
| 134 | - print ' ' + e.glyphname \
|
| 135 | + print(' ' + e.glyphname \
|
| 136 | + '(' + str( e.encoding ) \
|
| 137 | + ') width is ' + str( e.width ) \
|
| 138 | - + ' not ' + str( nonzero )
|
| 139 | + + ' not ' + str( nonzero ))
|
| 140 | problem = True
|
| 141 |
|
| 142 | ( xmin, ymin, xmax, ymax ) = e.boundingBox()
|
| 143 | if ymin < -200 or ymax > 800:
|
| 144 | - print ' ' + e.glyphname + ' goes between heights ' \
|
| 145 | - + str( ymin ) + ' and ' + str( ymax )
|
| 146 | + print(' ' + e.glyphname + ' goes between heights ' \
|
| 147 | + + str( ymin ) + ' and ' + str( ymax ))
|
| 148 | """
|
| 149 | For FontForge handling of TrueType/OpenType magic characters:
|
| 150 | 1) check that 0x0000 0x0001, 0x000D exist and have names
|
| 151 | @@ -71,15 +71,15 @@ def ismonomono( fontfilename ):
|
| 152 | if not font[0x0000] \
|
| 153 | or font[0x0000].glyphname != '.notdef' \
|
| 154 | or font[0x0000].width != nonzero:
|
| 155 | - print 'Should be full-width ".notdef" glyph at 0x0000.'
|
| 156 | + print('Should be full-width ".notdef" glyph at 0x0000.')
|
| 157 | if not font[0x0001] \
|
| 158 | or font[0x0001].glyphname != '.null' \
|
| 159 | or font[0x0001].width != 0:
|
| 160 | - print 'Should be zero-width ".null" glyph at 0x0001.'
|
| 161 | + print('Should be zero-width ".null" glyph at 0x0001.')
|
| 162 | if not font[0x000D] \
|
| 163 | or font[0x000D].glyphname != 'nonmarkingreturn' \
|
| 164 | or font[0x000D].width != nonzero:
|
| 165 | - print 'Should be full-width "nonmarkingreturn" glyph at 0x000D.'
|
| 166 | + print('Should be full-width "nonmarkingreturn" glyph at 0x000D.')
|
| 167 |
|
| 168 | scriptname = sys.argv[0];
|
| 169 | argc = len( sys.argv )
|
| 170 | diff --git a/tools/test/validate.py b/tools/test/validate.py
|
| 171 | index da9ce96..a8b216f 100755
|
| 172 | |
| 173 | |
| 174 | @@ -43,7 +43,7 @@ def countPointsInLayer( layer ):
|
| 175 | return p
|
| 176 |
|
| 177 | def printProblemLine( e, msg ):
|
| 178 | - print "\t" + e.glyphname + msg
|
| 179 | + print( "\t" + e.glyphname + msg)
|
| 180 |
|
| 181 | def dealWithValidationState( state, e ):
|
| 182 | if state & 0x2:
|
| 183 | @@ -87,7 +87,7 @@ def dealWithValidationState( state, e ):
|
| 184 | def validate( dir, fontFile ):
|
| 185 | try:
|
| 186 | font = fontforge.open( dir + fontFile )
|
| 187 | - print "Validating " + fontFile
|
| 188 | + print("Validating " + fontFile)
|
| 189 |
|
| 190 | g = font.selection.all()
|
| 191 | g = font.selection.byGlyphs
|
| 192 | @@ -98,7 +98,7 @@ def validate( dir, fontFile ):
|
| 193 | if state != 0:
|
| 194 | dealWithValidationState( state, e )
|
| 195 | font.validate
|
| 196 | - except Exception, e:
|
| 197 | + except(Exception, e):
|
| 198 | problem = True
|
| 199 | print >> sys.stderr, str( e )
|
| 200 |
|