summaryrefslogtreecommitdiff
path: root/dev-perl/Font-AFM/files/Font-AFM-1.20-custom-test-font.patch
blob: 3e674599c33f7a58dd13cef0ed45991a1ecb8492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 6291356c29004b58b7d0f18ce39738ebc2412ff9 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@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