groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 21/21: [troff]: Fix Savannah #62941.


From: G. Branden Robinson
Subject: [groff] 21/21: [troff]: Fix Savannah #62941.
Date: Tue, 23 Aug 2022 14:18:43 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 87efb8ff373d5cf3b92be9d21445a80b264fa961
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Aug 23 09:25:38 2022 -0500

    [troff]: Fix Savannah #62941.
    
    * src/roff/troff/env.cpp (environment::set_family): Throw error if user
      requests a font family that (when combined with the current style)
      can't be resolved to a real font name.  Fixes a regression introduced
      by me in commit d8cb8cf9d8, 2021-09-15, arising from a revision of
      font selection logic in node.cpp to enable a bunch of _other_ font
      error diagnostics.
    
    Fixes <https://savannah.gnu.org/bugs/?62941>.  Thanks to Dave Kemper for
    the report and two useful end points for a bisection.
    
    Here's an illustration of groff 1.22.4 and Git HEAD diagnostics.
    
    $ nl EXPERIMENTS/font-errors.groff
         1  .uf Z
         2  .uf 99
         3  .fschar Z \[co] COPYRIGHT
         4  .fschar 99 \[co] COPYRIGHT
         5  .rfschar Z \[co]
         6  .rfschar 99 \[co]
         7  .special Y
         8  .special 98
         9  .fspecial Z Y
        10  .fspecial 99 Y
        11  .fzoom Z
        12  .fzoom 99
        13  .bd Z 3
        14  .bd 99 3
        15  .bd S Z 3
        16  .bd S 99 3
        17  .bd 98 Z 3
        18  .bd 98 99 3
        19  .tkf Z
        20  .tkf 99
        21  .cs Z
        22  .cs 99
        23  .fam BOGUS
    
    $ groff -z EXPERIMENTS/font-errors.groff
    troff: EXPERIMENTS/font-errors.groff:1: warning: can't find font 'Z'
    troff: EXPERIMENTS/font-errors.groff:2: bad font number
    troff: EXPERIMENTS/font-errors.groff:4: bad font number
    troff: EXPERIMENTS/font-errors.groff:6: bad font number
    troff: EXPERIMENTS/font-errors.groff:7: warning: can't find font 'Y'
    troff: EXPERIMENTS/font-errors.groff:8: bad font number
    troff: EXPERIMENTS/font-errors.groff:10: bad font number
    troff: EXPERIMENTS/font-errors.groff:12: bad font number
    troff: EXPERIMENTS/font-errors.groff:14: bad font number
    troff: EXPERIMENTS/font-errors.groff:17: bad font number
    troff: EXPERIMENTS/font-errors.groff:18: bad font number
    troff: EXPERIMENTS/font-errors.groff:20: bad font number
    troff: EXPERIMENTS/font-errors.groff:22: bad font number
    troff: EXPERIMENTS/font-errors.groff:23: warning: can't find font 'BOGUSR'
    
    $ ./build/test-groff -z EXPERIMENTS/font-errors.groff
    troff:EXPERIMENTS/font-errors.groff:1: error: cannot load font 'Z' to make 
it the underline font
    troff:EXPERIMENTS/font-errors.groff:2: error: cannot load font at position 
99 to make it the underline font
    troff:EXPERIMENTS/font-errors.groff:3: error: cannot load font 'Z' to 
define font-specific fallback glyph
    troff:EXPERIMENTS/font-errors.groff:4: error: cannot load font at position 
99 to define font-specific fallback glyph
    troff:EXPERIMENTS/font-errors.groff:5: error: cannot load font 'Z' to 
remove font-specific fallback glyph
    troff:EXPERIMENTS/font-errors.groff:6: error: cannot load font at position 
99 to remove font-specific fallback glyph
    troff:EXPERIMENTS/font-errors.groff:7: error: cannot load font 'Y' to mark 
it as special
    troff:EXPERIMENTS/font-errors.groff:8: error: cannot load font at position 
98 to mark it as special
    troff:EXPERIMENTS/font-errors.groff:9: error: cannot load font 'Z' to mark 
other fonts as special contingently upon it
    troff:EXPERIMENTS/font-errors.groff:10: error: cannot load font at position 
99 to mark other fonts as special contingently upon it
    troff:EXPERIMENTS/font-errors.groff:11: error: cannot load font 'Z' to set 
a zoom factor for it
    troff:EXPERIMENTS/font-errors.groff:12: error: cannot load font at position 
99 to set a zoom factor for it
    troff:EXPERIMENTS/font-errors.groff:13: error: cannot load font 'Z' for 
emboldening
    troff:EXPERIMENTS/font-errors.groff:14: error: cannot load font at position 
99 for emboldening
    troff:EXPERIMENTS/font-errors.groff:15: error: cannot load font 'Z' for 
conditional emboldening
    troff:EXPERIMENTS/font-errors.groff:16: error: cannot load font at position 
99 for conditional emboldening
    troff:EXPERIMENTS/font-errors.groff:17: error: cannot load font at position 
98 for emboldening
    troff:EXPERIMENTS/font-errors.groff:18: error: cannot load font at position 
98 for emboldening
    troff:EXPERIMENTS/font-errors.groff:19: error: cannot load font 'Z' for 
track kerning
    troff:EXPERIMENTS/font-errors.groff:20: error: cannot load font at position 
99 for track kerning
    troff:EXPERIMENTS/font-errors.groff:21: error: cannot load font 'Z' for 
constant spacing
    troff:EXPERIMENTS/font-errors.groff:22: error: cannot load font at position 
99 for constant spacing
    troff:EXPERIMENTS/font-errors.groff:23: error: no font family named 'BOGUS' 
exists
---
 ChangeLog              | 12 ++++++++++++
 src/roff/troff/env.cpp |  4 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d9f6c3d3c..da857b542 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-08-23  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/env.cpp (environment::set_family): Throw error
+       if user requests a font family that (when combined with the
+       current style) can't be resolved to a real font name.  Fixes a
+       regression introduced by me in commit d8cb8cf9d8, 2021-09-15,
+       arising from a revision of font selection logic in node.cpp to
+       enable a bunch of _other_ font error diagnostics.
+
+       Fixes <https://savannah.gnu.org/bugs/?62941>.  Thanks to Dave
+       Kemper for the report and two useful end points for a bisection.
+
 2022-08-23  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/env.cpp (environment::set_family): Add some
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 160c1378a..3e49a36da 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -567,8 +567,10 @@ void environment::set_family(symbol fam)
           (0 != "font family dictionary lookup"));
     if (0 /* nullptr */ == f)
       return;
-    if (f->make_definite(fontno) < 0)
+    if (f->make_definite(fontno) < 0) {
+      error("no font family named '%1' exists", fam.contents());
       return;
+    }
     prev_family = family;
     family = f;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]