deri pushed a commit to branch master
in repository groff.

commit 69d9eba3680968edddad3842a770339e24cbdccb
Author: Deri James <d...@chuzzlewit.myzen.co.uk>
AuthorDate: Tue Jul 1 18:51:21 2025 +0100

    [gropdf] More rational handling of duplicate font entries.
    
    * src/devices/gropdf/gropdf.pl (LoadFont): The primary entry
    has a proper postscript name such as 'iota' whereas
    alternatives tend to have 'uniXXXX' or 'afiiNNNNN'. So
    choose the primary.
---
 ChangeLog                    |  9 +++++++++
 src/devices/gropdf/gropdf.pl | 16 +++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 70e95528b..524ed1820 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-07-01  Deri James  <d...@chuzzlewit.myzen.co.uk>
+
+       [gropdf] More rational handling of duplicate font entries.
+
+       * src/devices/gropdf/gropdf.pl (LoadFont): The primary entry
+       has a proper postscript name such as 'iota' whereas
+       alternatives tend to have 'uniXXXX' or 'afiiNNNNN'. So
+       choose the primary.
+
 2025-07-01  Deri James  <d...@chuzzlewit.myzen.co.uk>
 
        [gropdf] Changes for greek glyphs
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 74e73f07f..89deb83c1 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -3453,7 +3453,21 @@ sub LoadFont
            $r[3]=oct($r[3]) if substr($r[3],0,1) eq '0';
            $r[4]=$r[0] if !defined($r[4]);
            $r[6]=$1 if !defined($r[6] and defined($r[5]) and $r[5]=~m/^-- 
([0-9A-F]{4})/);
-           $r[0]="#$r[3]" if exists($fnt{NAM}->{$r[0]});
+           if (exists($fnt{NAM}->{$r[0]}))
+           {
+               # Prefer postscript names other than 'uni' or 'afii' as primary
+               if ($fnt{NAM}->{$r[0]}->[2]=~m'^/(:afii\d{5}|uni[A-F0-9]{4,5})')
+               {
+                   my $n=$fnt{NAM}->{$r[0]}->[1];
+                   $fnt{NAM}->{"#$n"}=$fnt{NAM}->{$r[0]};
+                   $fnt{NO}->[$n]="#$n";
+               }
+               else
+               {
+                   $r[0]="#$r[3]";
+               }
+           }
+
            $fnt{NAM}->{$r[0]}=[$p[0],$r[3],'/'.$r[4],undef,undef,$r[6]];
            $fnt{NO}->[$r[3]]=$r[0];
            $lastnm=$r[0];

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to