gbranden pushed a commit to branch master
in repository groff.

commit 914cb1a2563b5527a81cd88262e28647deb2b9d0
Author: Deri James <[email protected]>
AuthorDate: Fri Nov 24 16:02:00 2023 +0000

    [gropdf]: Fix processing of catenated dit (`-Z`).
    
    Normally it is safe to pass concatenated dit files to gropdf, typically
    this would be a separate source file which produces a custom cover and a
    different source for the body (different macro set?). Problem occurs if
    one of the dits uses the same fontno for a different font. Normally
    troff allocates TR to #5, but if one of the dits has been run with the
    flag "U-T" then U-TR is allocated to #5.
    
    * src/devices/gropdf/gropdf.pl (LoadFont): Check if "x font # name" has
      the same number AND name as a previously registered font, otherwise
      reload the font.
---
 ChangeLog                    | 16 ++++++++++++++++
 src/devices/gropdf/gropdf.pl |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 0f8de1caf..b5c5ab890 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2023-11-24  Deri James  <[email protected]>
+
+       [gropdf]: Fix processing of catenated dit files (-Z).
+
+       Normally it is safe to pass concatenated dit files to gropdf,
+       typically this would be a separate source file which produces a
+       custom cover and a different source for the body (different
+       macro set?). Problem occurs if one of the dits uses the same
+       fontno for a different font. Normally troff allocates TR to #5,
+       but if one of the dits has been run with the flag "U-T" then
+       U-TR is allocated to #5.
+
+       * src/devices/gropdf/gropdf.pl (LoadFont): Check if "x font #
+       name" has the same number AND name as a previously registered
+       font, otherwise reload the font.
+
 2023-12-29  G. Branden Robinson <[email protected]>
 
        * src/devices/grotty/tty.cpp (tty_printer::end_page): Add
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 0e1b612a5..8cbadc353 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2447,7 +2447,7 @@ sub LoadFont
     my $fontnm=shift;
     my $ofontnm=$fontnm;
 
-    return $fontlst{$fontno}->{OBJ} if (exists($fontlst{$fontno}));
+    return $fontlst{$fontno}->{OBJ} if (exists($fontlst{$fontno}) and $fontnm 
eq $fontlst{$fontno}->{FNT}->{name}) ;
 
     my $f;
     OpenFile(\$f,$fontdir,"$fontnm");

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to