guix/gnu/packages/patches/font-gnu-freefont-python3-compat.patch
Efraim Flashner 9eef9cd8ad
gnu: font-gnu-freefont: Build with newer fontforge.
* gnu/packages/fonts.scm (font-gnu-freefont)[source]: Add patch.  Add
snippet to remove processed python code.
* gnu/packages/patches/font-gnu-freefont-python3-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I042697aba1ca4ff7448cd4fb62268e62fd883bc2
2024-06-06 15:10:40 +03:00

200 lines
7.2 KiB
Diff

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 )