summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2024-06-06 13:03:21 +0300
committerEfraim Flashner <efraim@flashner.co.il>2024-06-06 15:10:40 +0300
commit9eef9cd8ade71fd25e5c407c17e009d421968992 (patch)
tree1d228f317aa6870aa73c53198989e23f0c2efd38 /gnu
parent825fcecb7adc823c29585f702f2b44056b0ffc11 (diff)
downloadguix-9eef9cd8ade71fd25e5c407c17e009d421968992.tar.gz
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
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/fonts.scm13
-rw-r--r--gnu/packages/patches/font-gnu-freefont-python3-compat.patch200
3 files changed, 208 insertions, 6 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 6577650776..9cd3afadf6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1230,6 +1230,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/flatpak-unset-gdk-pixbuf-for-sandbox.patch	\
   %D%/packages/patches/fluxbox-1.3.7-no-dynamic-cursor.patch	\
   %D%/packages/patches/fluxbox-1.3.7-gcc.patch			\
+  %D%/packages/patches/font-gnu-freefont-python3-compat.patch	\
   %D%/packages/patches/fontconfig-cache-ignore-mtime.patch	\
   %D%/packages/patches/fontforge-hurd.patch			\
   %D%/packages/patches/foobillard++-pkg-config.patch		\
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index a5c8cfadce..cab12d6527 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -11,7 +11,7 @@
 ;;; Copyright © 2016 Jookia <166291@gmail.com>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Dmitry Nikolaev <cameltheman@gmail.com>
-;;; Copyright © 2016-2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016-2024 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2016 Toni Reina <areina@riseup.net>
 ;;; Copyright © 2017–2022 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -88,6 +88,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system trivial)
+  #:use-module (gnu packages)
   #:use-module (gnu packages c)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
@@ -436,8 +437,6 @@ font is provided in the OpenType font (OTF) format.")
 (define-public font-gnu-freefont
   (package
     (name "font-gnu-freefont")
-    ;; Note: Remove the special FontForge input and package once the 2020
-    ;; release is out.
     (version "20120503")
     (source (origin
              (method url-fetch)
@@ -445,7 +444,10 @@ font is provided in the OpenType font (OTF) format.")
                                  version ".tar.gz"))
              (sha256
               (base32
-               "0yk58blhcd4hm7nyincmqq4jrzjjk82wif2zmk1l3y2m4vif4qhd"))))
+               "0yk58blhcd4hm7nyincmqq4jrzjjk82wif2zmk1l3y2m4vif4qhd"))
+             (patches (search-patches "font-gnu-freefont-python3-compat.patch"))
+             (snippet
+              '(begin (delete-file "tools/generate/buildutils.pyc")))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases
@@ -491,8 +493,7 @@ font is provided in the OpenType font (OTF) format.")
                                    (lambda (file) (string-suffix? "woff" file))
                                    (find-files "." "")))))))
        #:test-target "tests"))
-    ;; FreeFont anno 2012 requires a FontForge built with Python 2.
-    (native-inputs (list fontforge-20190801))
+    (native-inputs (list fontforge))
     (home-page "https://www.gnu.org/software/freefont/")
     (synopsis "Unicode-encoded outline fonts")
     (description
diff --git a/gnu/packages/patches/font-gnu-freefont-python3-compat.patch b/gnu/packages/patches/font-gnu-freefont-python3-compat.patch
new file mode 100644
index 0000000000..3b21d53b0b
--- /dev/null
+++ b/gnu/packages/patches/font-gnu-freefont-python3-compat.patch
@@ -0,0 +1,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 )
+