762 lines
26 KiB
Diff
762 lines
26 KiB
Diff
diff -up ./doc/fonts/gnu-freefont/tools/report/kernclasses.py.py3 ./doc/fonts/gnu-freefont/tools/report/kernclasses.py
|
|
--- ./doc/fonts/gnu-freefont/tools/report/kernclasses.py.py3 2019-08-18 08:17:06.470597138 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/report/kernclasses.py 2019-08-18 08:27:48.164149606 -0400
|
|
@@ -16,10 +16,10 @@ def get_kern_subtables( font ):
|
|
if font.isKerningClass( st ):
|
|
tables.append( st )
|
|
return tables
|
|
- except EnvironmentError, ( e ):
|
|
- print >> sys.stderr, 'EnvironmentError ' + str( e )
|
|
- except TypeError, ( t ):
|
|
- print >> sys.stderr, 'TypeError ' + str( t )
|
|
+ except EnvironmentError as e:
|
|
+ print('EnvironmentError ' + str( e ), file=sys.stderr)
|
|
+ except TypeError as t:
|
|
+ print('TypeError ' + str( t ), file=sys.stderr)
|
|
return None
|
|
preamble = """
|
|
<html>
|
|
@@ -46,20 +46,20 @@ postamble="""
|
|
|
|
def print_kerns( fontPath ):
|
|
font = fontforge.open( fontPath )
|
|
- print '<h2>Kerning classes in ' + font.fontname + '</h2>'
|
|
+ print('<h2>Kerning classes in ' + font.fontname + '</h2>')
|
|
weight = ''
|
|
if font.os2_weight > 500:
|
|
weight = 'B'
|
|
style = ''
|
|
if font.italicangle < 0.0:
|
|
style = 'I'
|
|
- print '<div style="font-family: ' + font.familyname + '" ' \
|
|
- + 'class="' + weight + style + '">'
|
|
+ print('<div style="font-family: ' + font.familyname + '" ' \
|
|
+ + 'class="' + weight + style + '">')
|
|
subtables = get_kern_subtables( font )
|
|
for st in subtables:
|
|
- print '<h3>Subtable ' + st + '</h3>'
|
|
+ print('<h3>Subtable ' + st + '</h3>')
|
|
printKernsOfSubtable( font, st )
|
|
- print '</div>'
|
|
+ print('</div>')
|
|
sys.stdout.flush()
|
|
|
|
def printKernsOfSubtable( font, subtable ):
|
|
@@ -69,38 +69,38 @@ def printKernsOfSubtable( font, subtable
|
|
rightclasses = kclass[1]
|
|
kerns = kclass[2]
|
|
nr = len( rightclasses )
|
|
- print '<table class="classes"><tr>'
|
|
- print '<th>left classes: </th>'
|
|
- print '<th>right classes: </th>'
|
|
- print '<tr><td>'
|
|
+ print('<table class="classes"><tr>')
|
|
+ print('<th>left classes: </th>')
|
|
+ print('<th>right classes: </th>')
|
|
+ print('<tr><td>')
|
|
for lc in leftclasses:
|
|
if lc:
|
|
for c in lc:
|
|
printentity( font, c )
|
|
- print "<br />"
|
|
- print "</td>"
|
|
- print "<td>"
|
|
+ print("<br />")
|
|
+ print("</td>")
|
|
+ print("<td>")
|
|
for rc in rightclasses:
|
|
if rc:
|
|
for c in rc:
|
|
printentity( font, c )
|
|
- print "<br />"
|
|
- print "</td>"
|
|
- print "</tr>"
|
|
- print "</table>"
|
|
- print "<table>"
|
|
- print "<tr>"
|
|
- print "<th></th>"
|
|
+ print("<br />")
|
|
+ print("</td>")
|
|
+ print("</tr>")
|
|
+ print("</table>")
|
|
+ print("<table>")
|
|
+ print("<tr>")
|
|
+ print("<th></th>")
|
|
for rc in rightclasses:
|
|
if rc:
|
|
sys.stdout.write( "<th>" )
|
|
printentity( font, rc[0] )
|
|
sys.stdout.write( "</th>" )
|
|
- print "</tr>"
|
|
+ print("</tr>")
|
|
for lc in leftclasses:
|
|
m = 0
|
|
if lc:
|
|
- print "<tr>"
|
|
+ print("<tr>")
|
|
sys.stdout.write( "<th>" )
|
|
printentity( font, lc[0] )
|
|
sys.stdout.write( "</th>" )
|
|
@@ -122,18 +122,18 @@ def printKernsOfSubtable( font, subtable
|
|
printpair( font, lc[0], rc[0] )
|
|
sys.stdout.write( '</td>' )
|
|
m += 1
|
|
- print "</tr>"
|
|
+ print("</tr>")
|
|
n += 1
|
|
- print "</table>"
|
|
+ print("</table>")
|
|
|
|
def printentity( font, a ):
|
|
s = font.findEncodingSlot( a )
|
|
v = formatted_hex_value( s )
|
|
if s == -1:
|
|
v = '<span class="nonexistent"> </span>'
|
|
- print >> sys.stderr, font.fullname, 'Missing glyph: ' + a
|
|
+ print(font.fullname, 'Missing glyph: ' + a, file=sys.stderr)
|
|
elif not codepointIsInSomeRange( s ):
|
|
- print >> sys.stderr, font.fullname, 'Non-unicode: ' + v
|
|
+ print(font.fullname, 'Non-unicode: ' + v, file=sys.stderr)
|
|
sys.stdout.write( v )
|
|
|
|
def printpair( font, p, q ):
|
|
@@ -150,9 +150,9 @@ def printlist( lst ):
|
|
for m in lst:
|
|
s += delim + m
|
|
delim = ' '
|
|
- print s
|
|
+ print(s)
|
|
|
|
-print preamble
|
|
+print(preamble)
|
|
#print_kerns( '/home/swhite/font_stuff/urwsr-ttf/URWPalladioL-Roman-test.sfd' )
|
|
print_kerns( '../../sfd/FreeSerif.sfd' )
|
|
print_kerns( '../../sfd/FreeSerifItalic.sfd' )
|
|
@@ -166,4 +166,4 @@ print_kerns( '../../sfd/FreeMono.sfd' )
|
|
print_kerns( '../../sfd/FreeMonoOblique.sfd' )
|
|
print_kerns( '../../sfd/FreeMonoBold.sfd' )
|
|
print_kerns( '../../sfd/FreeMonoBoldOblique.sfd' )
|
|
-print postamble
|
|
+print(postamble)
|
|
diff -up ./doc/fonts/gnu-freefont/tools/report/ligatureLookups.py.py3 ./doc/fonts/gnu-freefont/tools/report/ligatureLookups.py
|
|
--- ./doc/fonts/gnu-freefont/tools/report/ligatureLookups.py.py3 2019-08-18 08:30:22.164442327 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/report/ligatureLookups.py 2019-08-18 08:33:04.545533305 -0400
|
|
@@ -60,10 +60,10 @@ def get_ligature_lookups( font ):
|
|
for st in sts:
|
|
tables.append( st )
|
|
return tables
|
|
- except EnvironmentError, ( e ):
|
|
- print >> stderr, 'EnvironmentError ' + str( e )
|
|
- except TypeError, ( t ):
|
|
- print >> stderr, 'TypeError ' + str( t )
|
|
+ except EnvironmentError as e:
|
|
+ print('EnvironmentError ' + str( e ), file=stderr)
|
|
+ except TypeError as t:
|
|
+ print('TypeError ' + str( t ), file=stderr)
|
|
return None
|
|
|
|
_preamble= """<?xml version="1.0" encoding="utf-8"?>
|
|
@@ -105,8 +105,8 @@ def print_ligatures( fontPath ):
|
|
if font.weight == 'Bold':
|
|
weight = "font-weight: bold; "
|
|
|
|
- print _style_div_html % ( font.familyname, style, weight )
|
|
- print _lig_header_html % ( font.fontname )
|
|
+ print(_style_div_html % ( font.familyname, style, weight ))
|
|
+ print(_lig_header_html % ( font.fontname ))
|
|
|
|
subtable_names = get_ligature_lookups( font )
|
|
for subtable_name in subtable_names:
|
|
@@ -115,7 +115,7 @@ def print_ligatures( fontPath ):
|
|
out = htmlListOfLigSubtable( font, subtable, subtables )
|
|
stdout.writelines( out )
|
|
stdout.flush()
|
|
- print '</div>'
|
|
+ print('</div>')
|
|
|
|
class Ligature:
|
|
def __init__( self, glyph ):
|
|
@@ -184,7 +184,7 @@ def makeLigatureSubtable( font, subtable
|
|
ligature = Ligature( g )
|
|
for lr in ligs:
|
|
if len( lr ) < 3 or lr[1] != 'Ligature':
|
|
- print >> stderr, font.fullname, '- non-ligature: ', g.glyphname
|
|
+ print(font.fullname, '- non-ligature: ', g.glyphname, file=stderr)
|
|
break
|
|
i = 2
|
|
while i < len( lr ):
|
|
@@ -242,11 +242,11 @@ def nestedEntity( font, subtable, a, sub
|
|
if s >= 0xe000 and s <= 0xf8ff: # Unicode only
|
|
lig = findLigatureGlyph( s, subtables )
|
|
if lig:
|
|
- #print >> stderr, 'Nested glyph found: ' + a
|
|
+ #print('Nested glyph found: ' + a, file=stderr)
|
|
for p in lig.parts:
|
|
return nestedEntity( font, subtable, p, subtables )
|
|
else:
|
|
- print >> stderr, font.fullname, '- No nested glyph: ', a
|
|
+ print(font.fullname, '- No nested glyph: ', a, file=stderr)
|
|
return '<span class="nonchar"> </span>'
|
|
else:
|
|
return entityHTML( font, a )
|
|
@@ -254,7 +254,7 @@ def nestedEntity( font, subtable, a, sub
|
|
def entityHTML( font, a ):
|
|
s = font.findEncodingSlot( a )
|
|
if s == -1:
|
|
- print >> stderr, font.fullname, '- Missing glyph: ', a
|
|
+ print(font.fullname, '- Missing glyph: ', a, file=stderr)
|
|
return '<span class="nonchar"> </span>'
|
|
else:
|
|
return formatted_hex_value( s )
|
|
@@ -266,11 +266,11 @@ def formatted_hex_value( n ):
|
|
args = argv[1:]
|
|
|
|
if len( args ) < 1 or len( args[0].strip() ) == 0:
|
|
- print >> stderr, __usage
|
|
+ print(__usage, file=stderr)
|
|
exit( 0 )
|
|
|
|
-print _preamble
|
|
+print(_preamble)
|
|
for font_name in args:
|
|
print_ligatures( font_name )
|
|
-print _postamble
|
|
+print(_postamble)
|
|
|
|
diff -up ./doc/fonts/gnu-freefont/tools/report/private_use.py.py3 ./doc/fonts/gnu-freefont/tools/report/private_use.py
|
|
--- ./doc/fonts/gnu-freefont/tools/report/private_use.py.py3 2019-08-18 08:33:25.445030197 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/report/private_use.py 2019-08-18 08:35:14.606402370 -0400
|
|
@@ -48,32 +48,32 @@ postamble="""
|
|
def print_private( fontPath ):
|
|
font = fontforge.open( fontPath )
|
|
|
|
- print '<div style="font-family: \'' + font.familyname + '\'; ' \
|
|
- '\">'
|
|
- print '<h2>Private Use Area in ' + font.fontname + '</h2>'
|
|
+ print('<div style="font-family: \'' + font.familyname + '\'; ' \
|
|
+ '\">')
|
|
+ print('<h2>Private Use Area in ' + font.fontname + '</h2>')
|
|
|
|
font.selection.select(("ranges",None),0xe000,0xf8ff)
|
|
- print '<table>'
|
|
+ print('<table>')
|
|
for g in font.selection.byGlyphs:
|
|
- print '<tr><td>'
|
|
- print '%s%0.4x%s' %( "0x", g.encoding, "" )
|
|
- print '</td><td>'
|
|
- print '' + g.glyphname
|
|
- print '</td><td>'
|
|
+ print('<tr><td>')
|
|
+ print('%s%0.4x%s' %( "0x", g.encoding, "" ))
|
|
+ print('</td><td>')
|
|
+ print('' + g.glyphname)
|
|
+ print('</td><td>')
|
|
if g.getPosSub( '*' ):
|
|
- print "is ligature"
|
|
+ print("is ligature")
|
|
if g.references:
|
|
- print "has references"
|
|
- print '</td><td>'
|
|
- print '</td></tr>'
|
|
+ print("has references")
|
|
+ print('</td><td>')
|
|
+ print('</td></tr>')
|
|
|
|
- print '</table>'
|
|
- print '</div>'
|
|
+ print('</table>')
|
|
+ print('</div>')
|
|
sys.stdout.flush()
|
|
|
|
def printentity( font, s ):
|
|
if s == -1:
|
|
- print >> sys.stderr, 'Missing glyph: ' + a
|
|
+ print('Missing glyph: ' + a, file=sys.stderr)
|
|
sys.stdout.write( '<span class="nonchar"> </span>' )
|
|
else:
|
|
sys.stdout.write( formatted_hex_value( s ) )
|
|
@@ -86,7 +86,7 @@ args = sys.argv[1:]
|
|
if len( args ) < 1 or len( args[0].strip() ) == 0:
|
|
sys.exit( 0 )
|
|
|
|
-print makePreamble()
|
|
+print(makePreamble())
|
|
for font_name in args:
|
|
print_private( font_name )
|
|
-print postamble
|
|
+print(postamble)
|
|
diff -up ./doc/fonts/gnu-freefont/tools/report/range_report.py.py3 ./doc/fonts/gnu-freefont/tools/report/range_report.py
|
|
--- ./doc/fonts/gnu-freefont/tools/report/range_report.py.py3 2019-08-18 08:35:42.417732872 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/report/range_report.py 2019-08-18 08:39:50.949749956 -0400
|
|
@@ -63,8 +63,8 @@ def count_glyphs_in_intervals( font, int
|
|
for e in g:
|
|
num += 1
|
|
except ValueError:
|
|
- print >> stderr, "interval " + str( r ) \
|
|
- + " not representable in " + font.fontname
|
|
+ print("interval " + str( r ) \
|
|
+ + " not representable in " + font.fontname, file=stderr)
|
|
exit( 1 )
|
|
return num
|
|
|
|
@@ -96,7 +96,7 @@ class FontSupport:
|
|
|
|
r = font.os2_unicoderanges
|
|
|
|
- # print >> stderr, font.fontname, hex( r[0] ), hex( r[1] ),hex( r[2] ),hex( r[3] );
|
|
+ # print(font.fontname, hex( r[0] ), hex( r[1] ),hex( r[2] ),hex( r[3] ), file=stderr);
|
|
|
|
nRanges = len( ulUnicodeRange )
|
|
|
|
@@ -111,16 +111,16 @@ class FontSupport:
|
|
cp = g.encoding
|
|
if ( not codepointIsInSomeRange( cp )
|
|
and not codepointIsSpecialTT( cp ) ):
|
|
- print >> stderr, font.fontname, \
|
|
- "no range for", hex( cp )
|
|
+ print(font.fontname, \
|
|
+ "no range for", hex( cp ), file=stderr)
|
|
|
|
""" '''Would like to check that special TT slots are
|
|
present, but don't know how...'''
|
|
for cp in special_TT_points:
|
|
font.selection.all()
|
|
if not cp in font.selection.byGlyphs:
|
|
- print >> stderr, font.fontname, \
|
|
- "special TT glyph missing", hex( cp )
|
|
+ print(font.fontname, \
|
|
+ "special TT glyph missing", hex( cp ), file=stderr)
|
|
"""
|
|
|
|
def collectRangeInfo( self, font, os2supportbyte, bit, index ):
|
|
@@ -135,13 +135,13 @@ class FontSupport:
|
|
|
|
def setRangeSupport( self, idx, supports, total ):
|
|
if self.myInfos.has_key( idx ):
|
|
- print >> stderr, "OS/2 index ", idx, " duplicated"
|
|
+ print("OS/2 index ", idx, " duplicated", file=stderr)
|
|
exit( 1 )
|
|
self.myInfos[idx] = SupportInfo( idx, supports, total )
|
|
|
|
def getInfo( self, idx ):
|
|
if not self.myInfos.has_key( idx ):
|
|
- print >> stderr, "OS/2 index ", idx, " not found"
|
|
+ print("OS/2 index ", idx, " not found", file=stderr)
|
|
exit( 1 )
|
|
return self.myInfos[ idx ]
|
|
|
|
@@ -177,7 +177,7 @@ def print_font_range_table( fontSupportL
|
|
headings = ''
|
|
for fsl in fontSupportList:
|
|
headings += '<th colspan="2">' + fsl.short + '</th>'
|
|
- print table_head % ( headings )
|
|
+ print(table_head % ( headings ))
|
|
|
|
for r in ulUnicodeRange:
|
|
idx = r[0]
|
|
@@ -190,10 +190,10 @@ def print_font_range_table( fontSupportL
|
|
if idx == 60 or idx == 90:
|
|
rowclass = ' class="private"'
|
|
|
|
- print '<tr%s><td>%s</td>' % ( rowclass, range_name )
|
|
- print '<td class="num">%i</td>' % (
|
|
- total_intervals( intervals ) )
|
|
- print '<td></td>'
|
|
+ print('<tr%s><td>%s</td>' % ( rowclass, range_name ))
|
|
+ print('<td class="num">%i</td>' % (
|
|
+ total_intervals( intervals ) ))
|
|
+ print('<td></td>')
|
|
for fsl in fontSupportList:
|
|
supportInfo = fsl.getInfo( idx )
|
|
supportString = ''
|
|
@@ -203,28 +203,28 @@ def print_font_range_table( fontSupportL
|
|
if supportInfo.total:
|
|
totalStr = str( supportInfo.total )
|
|
|
|
- print '<td class="num">%s</td><td>%s</td>' % (
|
|
- totalStr, supportString )
|
|
+ print('<td class="num">%s</td><td>%s</td>' % (
|
|
+ totalStr, supportString ))
|
|
|
|
- print '</tr>'
|
|
- print '<tr><th colspan="3">total in Unicode ranges</th>'
|
|
+ print('</tr>')
|
|
+ print('<tr><th colspan="3">total in Unicode ranges</th>')
|
|
for fsl in fontSupportList:
|
|
- print '<td class="num" colspan="2">%i </td>' % (
|
|
- fsl.totalGlyphs )
|
|
- print '</tr>'
|
|
- print '<tr><th colspan="3">total in font</th>'
|
|
+ print('<td class="num" colspan="2">%i </td>' % (
|
|
+ fsl.totalGlyphs ))
|
|
+ print('</tr>')
|
|
+ print('<tr><th colspan="3">total in font</th>')
|
|
for fsl in fontSupportList:
|
|
- print '<td class="num" colspan="2">%i </td>' % (
|
|
- fsl.fontTotalGlyphs )
|
|
- print '</tr>'
|
|
- print '<tr><th colspan="3">total in Private Use</th>'
|
|
+ print('<td class="num" colspan="2">%i </td>' % (
|
|
+ fsl.fontTotalGlyphs ))
|
|
+ print('</tr>')
|
|
+ print('<tr><th colspan="3">total in Private Use</th>')
|
|
for fsl in fontSupportList:
|
|
- print '<td class="num" colspan="2">%i </td>' % (
|
|
- fsl.privateUseGlyphs )
|
|
- print '</tr>'
|
|
+ print('<td class="num" colspan="2">%i </td>' % (
|
|
+ fsl.privateUseGlyphs ))
|
|
+ print('</tr>')
|
|
# Would also like to total glyphs in ranges for each font,
|
|
# and also print total glyphs in each font.
|
|
- print '</table>'
|
|
+ print('</table>')
|
|
|
|
table_introduction = """
|
|
For historical reasons, TrueType classifies Unicode ranges according to
|
|
@@ -286,25 +286,25 @@ Gnu FreeFont character range support
|
|
'''
|
|
|
|
def print_font_range_report( fontSupportList ):
|
|
- print html_heading
|
|
+ print(html_heading)
|
|
|
|
- print '<body>'
|
|
- print '<h1>'
|
|
- print 'Gnu FreeFont support for OpenType OS/2 character ranges'
|
|
- print '</h1>'
|
|
- print '<p>'
|
|
- print table_introduction
|
|
- print '</p>'
|
|
+ print('<body>')
|
|
+ print('<h1>')
|
|
+ print('Gnu FreeFont support for OpenType OS/2 character ranges')
|
|
+ print('</h1>')
|
|
+ print('<p>')
|
|
+ print(table_introduction)
|
|
+ print('</p>')
|
|
print_font_range_table( fontSupportList )
|
|
- print '<p>'
|
|
- print table_explanation
|
|
+ print('<p>')
|
|
+ print(table_explanation)
|
|
tzset()
|
|
- print 'Generated by <code>range_report.py</code> on %s.' % (
|
|
- strftime('%X %x %Z') )
|
|
- print '</p>'
|
|
- print '</body>'
|
|
+ print('Generated by <code>range_report.py</code> on %s.' % (
|
|
+ strftime('%X %x %Z') ))
|
|
+ print('</p>')
|
|
+ print('</body>')
|
|
|
|
- print '</html>'
|
|
+ print('</html>')
|
|
|
|
supportList = []
|
|
supportList.append( FontSupport( '../../sfd/FreeSerif.sfd', 'Srf' ) )
|
|
diff -up ./doc/fonts/gnu-freefont/tools/script-menu/nameBySlot.py.py3 ./doc/fonts/gnu-freefont/tools/script-menu/nameBySlot.py
|
|
--- ./doc/fonts/gnu-freefont/tools/script-menu/nameBySlot.py.py3 2019-08-18 08:40:25.964907029 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/script-menu/nameBySlot.py 2019-08-18 08:41:02.911017630 -0400
|
|
@@ -38,7 +38,7 @@ import fontforge
|
|
|
|
def explain_error_and_quit( e ):
|
|
if e:
|
|
- print 'Error: ', e
|
|
+ print('Error: ', e)
|
|
exit( 1 )
|
|
|
|
try:
|
|
@@ -54,9 +54,9 @@ try:
|
|
newname = 'uni%0.7x' %( g.encoding )
|
|
elif g.encoding <= 0xFFFFFFFF:
|
|
newname = 'uni%0.8x' %( g.encoding )
|
|
- print "naming " + str( g.glyphname ) + ' as ' + newname
|
|
+ print("naming " + str( g.glyphname ) + ' as ' + newname)
|
|
g.glyphname = newname
|
|
g.unicode = g.encoding
|
|
-except ValueError, e:
|
|
+except ValueError as e:
|
|
explain_error_and_quit( e )
|
|
|
|
diff -up ./doc/fonts/gnu-freefont/tools/script-menu/unnameBySlot.py.py3 ./doc/fonts/gnu-freefont/tools/script-menu/unnameBySlot.py
|
|
--- ./doc/fonts/gnu-freefont/tools/script-menu/unnameBySlot.py.py3 2019-08-18 08:41:15.963703405 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/script-menu/unnameBySlot.py 2019-08-18 08:42:15.186277750 -0400
|
|
@@ -39,16 +39,16 @@ import fontforge
|
|
|
|
def explain_error_and_quit( e ):
|
|
if e:
|
|
- print 'Error: ', e
|
|
+ print('Error: ', e)
|
|
exit( 1 )
|
|
|
|
try:
|
|
glyphs = fontforge.activeFont().selection.byGlyphs
|
|
for g in glyphs:
|
|
newname = 'NameMe.%s' %( str( g.encoding ) )
|
|
- print "naming " + str( g.glyphname ) + ' as ' + newname
|
|
+ print("naming " + str( g.glyphname ) + ' as ' + newname)
|
|
g.glyphname = newname
|
|
g.unicode = -1
|
|
-except ValueError, e:
|
|
+except ValueError as e:
|
|
explain_error_and_quit( e )
|
|
|
|
diff -up ./doc/fonts/gnu-freefont/tools/test/checkGlyphNumbers.py.py3 ./doc/fonts/gnu-freefont/tools/test/checkGlyphNumbers.py
|
|
--- ./doc/fonts/gnu-freefont/tools/test/checkGlyphNumbers.py.py3 2019-08-18 08:42:25.687024974 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/test/checkGlyphNumbers.py 2019-08-18 08:43:16.562800246 -0400
|
|
@@ -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 -up ./doc/fonts/gnu-freefont/tools/test/findBackLayers.py.py3 ./doc/fonts/gnu-freefont/tools/test/findBackLayers.py
|
|
--- ./doc/fonts/gnu-freefont/tools/test/findBackLayers.py.py3 2019-08-18 08:43:27.206544016 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/test/findBackLayers.py 2019-08-18 08:44:00.456743596 -0400
|
|
@@ -32,7 +32,7 @@ from sys import exit
|
|
problem = False
|
|
|
|
def checkBackLayers( fontPath ):
|
|
- print "Checking " + fontPath
|
|
+ print("Checking " + fontPath)
|
|
font = fontforge.open( fontPath )
|
|
|
|
g = font.selection.all()
|
|
@@ -42,7 +42,7 @@ def checkBackLayers( fontPath ):
|
|
|
|
for e in g:
|
|
if e.layer_cnt != 2:
|
|
- print e
|
|
+ print(e)
|
|
|
|
checkBackLayers( '../sfd/FreeSerif.sfd' )
|
|
checkBackLayers( '../sfd/FreeSerifItalic.sfd' )
|
|
diff -up ./doc/fonts/gnu-freefont/tools/test/isMonoMono.py.py3 ./doc/fonts/gnu-freefont/tools/test/isMonoMono.py
|
|
--- ./doc/fonts/gnu-freefont/tools/test/isMonoMono.py.py3 2019-08-18 08:44:12.128462618 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/test/isMonoMono.py 2019-08-18 08:44:55.105428039 -0400
|
|
@@ -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 -up ./doc/fonts/gnu-freefont/tools/test/validate.py.py3 ./doc/fonts/gnu-freefont/tools/test/validate.py
|
|
--- ./doc/fonts/gnu-freefont/tools/test/validate.py.py3 2019-08-18 08:45:06.988141993 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/test/validate.py 2019-08-18 08:45:57.561924523 -0400
|
|
@@ -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:
|
|
@@ -81,13 +81,13 @@ def dealWithValidationState( state, e ):
|
|
if state & 0x10000:
|
|
printProblemLine( e, " has references deeper than allowed" )
|
|
if state & 0x20000:
|
|
- print e.glyphname + " fpgm or prep tables longer than allowed" )
|
|
+ print(e.glyphname + " fpgm or prep tables longer than allowed" ))
|
|
"""
|
|
|
|
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,9 +98,9 @@ def validate( dir, fontFile ):
|
|
if state != 0:
|
|
dealWithValidationState( state, e )
|
|
font.validate
|
|
- except Exception, e:
|
|
+ except Exception as e:
|
|
problem = True
|
|
- print >> sys.stderr, str( e )
|
|
+ print(str( e ), file=sys.stderr)
|
|
|
|
validate( '../sfd/', 'FreeSerif.sfd' )
|
|
validate( '../sfd/', 'FreeSerifItalic.sfd' )
|
|
diff -up ./doc/fonts/gnu-freefont/tools/utility/hex_range.py.py3 ./doc/fonts/gnu-freefont/tools/utility/hex_range.py
|
|
--- ./doc/fonts/gnu-freefont/tools/utility/hex_range.py.py3 2019-08-18 08:46:09.302641885 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/utility/hex_range.py 2019-08-18 08:46:58.356461003 -0400
|
|
@@ -40,13 +40,13 @@ postfix = ';'
|
|
|
|
def explain_error_and_quit( e ):
|
|
if e:
|
|
- print 'Error: ', e
|
|
- print "Usage:"
|
|
- print " hex_range num1 [num2]"
|
|
+ print('Error: ', e)
|
|
+ print("Usage:")
|
|
+ print(" hex_range num1 [num2]")
|
|
exit( 1 )
|
|
|
|
def print_formatted_hex_value( n ):
|
|
- print '%s%0.4x%s' %( prefix, n, postfix )
|
|
+ print('%s%0.4x%s' %( prefix, n, postfix ))
|
|
|
|
if len( sys.argv ) == 3:
|
|
try:
|
|
@@ -54,13 +54,13 @@ if len( sys.argv ) == 3:
|
|
b = int( sys.argv[2], 0 )
|
|
for i in xrange( a, b + 1 ):
|
|
print_formatted_hex_value( i )
|
|
- except ValueError, e:
|
|
+ except ValueError as e:
|
|
explain_error_and_quit( e )
|
|
elif len( sys.argv ) == 2:
|
|
try:
|
|
a = int( sys.argv[1], 0 )
|
|
print_formatted_hex_value( a )
|
|
- except ValueError, e:
|
|
+ except ValueError as e:
|
|
explain_error_and_quit( e )
|
|
else:
|
|
explain_error_and_quit()
|
|
diff -up ./doc/fonts/gnu-freefont/tools/utility/metafont/bulk_eps_import.py.py3 ./doc/fonts/gnu-freefont/tools/utility/metafont/bulk_eps_import.py
|
|
--- ./doc/fonts/gnu-freefont/tools/utility/metafont/bulk_eps_import.py.py3 2019-08-18 08:47:10.751162633 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/utility/metafont/bulk_eps_import.py 2019-08-18 08:47:43.083384292 -0400
|
|
@@ -35,11 +35,11 @@ import fnmatch, re
|
|
problem = False
|
|
|
|
def import_glyph( font, name, chrnum ):
|
|
- print "importing file: " + name + " to slot " + str( chrnum )
|
|
+ print("importing file: " + name + " to slot " + str( chrnum ))
|
|
|
|
g = font.createChar( chrnum )
|
|
|
|
- print "importing outlines " + name
|
|
+ print("importing outlines " + name)
|
|
g.importOutlines( name )
|
|
# The glyphs produced by MetaPost usually have a grid, whose
|
|
# right side seems to correspond to the proper right side bearing
|
|
@@ -56,7 +56,7 @@ re_file_pat = re.compile( file_pat )
|
|
if argc > 2:
|
|
fontfilename = sys.argv[1]
|
|
font = fontforge.open( fontfilename )
|
|
- print "bulk importing to font file: " + fontfilename
|
|
+ print("bulk importing to font file: " + fontfilename)
|
|
chrnum = 0
|
|
directories = os.listdir('.')
|
|
directories.sort()
|
|
diff -up ./doc/fonts/gnu-freefont/tools/utility/special-purpose/makeBraille.py.py3 ./doc/fonts/gnu-freefont/tools/utility/special-purpose/makeBraille.py
|
|
--- ./doc/fonts/gnu-freefont/tools/utility/special-purpose/makeBraille.py.py3 2019-08-18 08:49:05.631397114 -0400
|
|
+++ ./doc/fonts/gnu-freefont/tools/utility/special-purpose/makeBraille.py 2019-08-18 08:49:34.269707707 -0400
|
|
@@ -60,12 +60,12 @@ def createAndName( font, off ):
|
|
return font.createChar( 0x2800 + off, 'braille%0.2X' % off )
|
|
|
|
def drawtopsix( g, off ):
|
|
- print 'created', 'braille%0.2X' % off
|
|
+ print('created', 'braille%0.2X' % off)
|
|
g.clear()
|
|
g.right_side_bearing = glyphwidth
|
|
for col in range ( 0, 2 ):
|
|
for row in range ( 0, 3 ):
|
|
- print 'shift', ( 3 * col + row )
|
|
+ print('shift', ( 3 * col + row ))
|
|
state = ( 1 << ( 3 * col + row ) ) & off
|
|
drawdot( g, col, row, state )
|
|
|
|
diff -up ./doc/generic/enctex/unimap.py.py3 ./doc/generic/enctex/unimap.py
|
|
--- ./doc/generic/enctex/unimap.py.py3 2019-08-18 08:52:49.201015107 -0400
|
|
+++ ./doc/generic/enctex/unimap.py 2019-08-18 08:54:08.301110903 -0400
|
|
@@ -91,12 +91,12 @@ def linetype(line):
|
|
return LineType.Character, (int(line[:m.end()], 16),
|
|
line[m.end():].strip().lower())
|
|
if not line.startswith('\t'):
|
|
- raise ValueError, 'Queer line doesn\'t start with @ or Tab'
|
|
+ raise ValueError('Queer line doesn\'t start with @ or Tab')
|
|
line = line.strip()
|
|
if not line:
|
|
return LineType.Empty, None
|
|
if not LineType.map.has_key(line[0]):
|
|
- raise ValueError, 'Queer character info line (marker %s)' % line[0]
|
|
+ raise ValueError('Queer character info line (marker %s)' % line[0])
|
|
return line[0], line[1:].strip()
|
|
|
|
def utf8chars(u):
|
|
@@ -132,7 +132,7 @@ while typ:
|
|
char = val
|
|
elif typ == LineType.TeX:
|
|
if not val.startswith('\\'):
|
|
- raise ValueError, '%s is not a control seq (U%X)' % (val, char[0])
|
|
+ raise ValueError('%s is not a control seq (U%X)' % (val, char[0]))
|
|
if sect:
|
|
fw.write('\n%% %s\n' % sect)
|
|
sect = None
|