commit:     1d4c1e9575c0d95a488795974150ffa550d97716
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 01:47:06 2020 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 01:47:38 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d4c1e95

dev-perl/Font-AFM: -r bump to use urw-fonts instead for tests

- Add patch allowing use of arbitrary font names and arbitrary metrics
- Augment tests and deps to use a font from the urw-fonts pack

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Kent Fredric <kentnl <AT> gentoo.org>

 dev-perl/Font-AFM/Font-AFM-1.200.0-r3.ebuild       | 30 ++++++++++++++
 .../files/Font-AFM-1.20-custom-test-font.patch     | 46 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/dev-perl/Font-AFM/Font-AFM-1.200.0-r3.ebuild 
b/dev-perl/Font-AFM/Font-AFM-1.200.0-r3.ebuild
new file mode 100644
index 00000000000..b279f82659d
--- /dev/null
+++ b/dev-perl/Font-AFM/Font-AFM-1.200.0-r3.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DIST_AUTHOR=GAAS
+DIST_VERSION=1.20
+inherit perl-module
+
+DESCRIPTION="Parse Adobe Font Metric files"
+
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+BDEPEND="
+       test? (
+               media-fonts/urw-fonts
+       )
+"
+PATCHES=(
+       "${FILESDIR}/${PN}-1.20-custom-test-font.patch"
+)
+src_test() {
+       # nimbus sans l medium r normal iso8859-1
+       TEST_FONT="n019003l" \
+               TEST_FONT_WIDTH="4279" \
+               METRICS="${EPREFIX}/usr/share/fonts/urw-fonts" \
+               perl-module_src_test
+}

diff --git a/dev-perl/Font-AFM/files/Font-AFM-1.20-custom-test-font.patch 
b/dev-perl/Font-AFM/files/Font-AFM-1.20-custom-test-font.patch
new file mode 100644
index 00000000000..3e674599c33
--- /dev/null
+++ b/dev-perl/Font-AFM/files/Font-AFM-1.20-custom-test-font.patch
@@ -0,0 +1,46 @@
+From 6291356c29004b58b7d0f18ce39738ebc2412ff9 Mon Sep 17 00:00:00 2001
+From: Kent Fredric <ken...@gentoo.org>
+Date: Thu, 17 Sep 2020 13:28:34 +1200
+Subject: Allow overriding test font name
+
+This allows us to use helvetica-compatible fonts without needing an
+actual font called "Helvetica"
+---
+ t/afm.t | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/t/afm.t b/t/afm.t
+index 40addff..60ddcb8 100644
+--- a/t/afm.t
++++ b/t/afm.t
+@@ -1,7 +1,13 @@
+ require Font::AFM;
+ 
++my $test_font  = $ENV{TEST_FONT};
++my $test_width = $ENV{TEST_FONT_WIDTH};
++
++$test_font  = "Helvetica" unless defined $test_font  and length $test_font;
++$test_width = 4279        unless defined $test_width and length $test_width;
++
+ eval {
+-   $font = Font::AFM->new("Helvetica");
++   $font = Font::AFM->new($test_font);
+ };
+ if ($@) {
+    if ($@ =~ /Can't find the AFM file for/) {
+@@ -18,9 +24,9 @@ print "1..1\n";
+ 
+ $sw = $font->stringwidth("Gisle Aas");
+ 
+-if ($sw == 4279) {
+-    print "ok 1 Stringwith for Helvetica seems to work\n";
++if ($sw == $test_width) {
++    print "ok 1 Stringwith for \"$test_font\"(font) seems to work\n";
+ } else {
+-    print "not ok 1 The stringwidth of 'Gisle Aas' should be 4279 (it was 
$sw)\n";
++    print "not ok 1 The stringwidth of 'Gisle Aas' should be $test_width (it 
was $sw)\n";
+ }
+ 
+-- 
+2.28.0
+

Reply via email to