bug-groff
[Top][All Lists]
Advanced

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

[bug #62941] [troff] no warning when font family nonexistent


From: G. Branden Robinson
Subject: [bug #62941] [troff] no warning when font family nonexistent
Date: Tue, 23 Aug 2022 07:18:48 -0400 (EDT)

Follow-up Comment #3, bug #62941 (project groff):


d8cb8cf9d833b0a6afe525d11dc6a5ce242d1355 is the first bad commit
commit d8cb8cf9d833b0a6afe525d11dc6a5ce242d1355
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Sep 15 14:49:58 2021 +1000

    [troff]: Give font diagnostics more context.
    
    [troff]: Lift font mounting diagnostic messages to be closer to their
    user-controlled contexts to provide more information.  In many cases no
    diagnostic was being thrown at all when an unavailable font was
    requested by name, which is the method most users prefer, and which
    meant that failures resulting from typos in font names for many requests
    (`uf`, `fschar`, `rfschar`, `special`, `fspecial`, `fzoom`, `bd`, `tkf`,
    `cs`) were going unreported.  Also, these font warnings are promoted to
    errors because the request will utterly fail to do what was requested
    with no reasonable fallback.  Possibly, they were warnings in the first
    place because they could also be thrown regarding unavailable fonts
    encountered in device description files, and while that's bad news, it
    results in no formatting problems if it doesn't affect fonts that an
    input document actually uses; thus, a mere warning is appropriate.
    
    * src/roff/troff/node.cpp (struct font_lookup_info): New struct keeps
      the font name or position requested, and the position of successful
      font lookup.
    
      (font_lookup_info::font_lookup_info): Add constructor.
    
      (font_lookup_error): New function builds error message using a
      `font_lookup_info` struct and a message argument.
    
      (get_fontno): Rename to...
    
      (has_font): ...this.  Add argument to take a pointer to a
      `font_lookup_info` struct.  Return a `bool` indicating whether the
      lookup succeeded.  Place former `int` return value into the struct
      instead.  Populate the other struct members with the requested font
      name or position, as appropriate.
    
      (mount_font_no_translate): Stop throwing warning diagnostic here if a
      font cannot be loaded.  Instead, throw them...
    
      (font_position): ...here, and...
    
      (underline_font, define_font_special_character,
      remove_font_special_character, read_special_fonts,
      font_special_request, font_zoom_request, bold_font, track_kern,
      constant_space): ...here, using `font_lookup_info` structs and
      `has_font()`.
    
      (remove_font_special_character): Stop returning early if font lookup
      fails; it's gratuitously inconsistent with other similar functions
      (save one, which has a reason to be different).
    
      (define_font_special_character): Return early if font lookup fails and
      say why in a comment (we can't `skip_line()`).
    
    Input:
    
    .uf Z
    .uf 99
    .fschar Z \[co] COPYRIGHT
    .fschar 99 \[co] COPYRIGHT
    .rfschar Z \[co]
    .rfschar 99 \[co]
    .special Y
    .special 98
    .fspecial Z Y
    .fspecial 99 Y
    .fzoom Z
    .fzoom 99
    .bd Z 3
    .bd 99 3
    .bd S Z 3
    .bd S 99 3
    .bd 98 Z 3
    .bd 98 99 3
    .tkf Z
    .tkf 99
    .cs Z
    .cs 99
    
    groff 1.22.4 diagnostics:
    
    troff: ...:1: warning: can't find font 'Z'
    troff: ...:2: bad font number
    troff: ...:4: bad font number
    troff: ...:6: bad font number
    troff: ...:7: warning: can't find font 'Y'
    troff: ...:8: bad font number
    troff: ...:10: bad font number
    troff: ...:12: bad font number
    troff: ...:14: bad font number
    troff: ...:17: bad font number
    troff: ...:18: bad font number
    troff: ...:20: bad font number
    troff: ...:22: bad font number
    
    groff 1.23.0 diagnostics:
    
    troff: ...:1: error: cannot load font 'Z' to make it the underline font
    troff: ...:2: error: cannot load font at position 99 to make it the
underline font
    troff: ...:3: error: cannot load font 'Z' to define font-specific fallback
glyph
    troff: ...:4: error: cannot load font at position 99 to define
font-specific fallback glyph
    troff: ...:5: error: cannot load font 'Z' to remove font-specific fallback
glyph
    troff: ...:6: error: cannot load font at position 99 to remove
font-specific fallback glyph
    troff: ...:7: error: cannot load font 'Y' to mark it as special
    troff: ...:8: error: cannot load font at position 98 to mark it as
special
    troff: ...:9: error: cannot load font 'Z' to mark other fonts as special
contingently upon it
    troff: ...:10: error: cannot load font at position 99 to mark other fonts
as special contingently upon it
    troff: ...:11: error: cannot load font 'Z' to set a zoom factor for it
    troff: ...:12: error: cannot load font at position 99 to set a zoom factor
for it
    troff: ...:13: error: cannot load font 'Z' for emboldening
    troff: ...:14: error: cannot load font at position 99 for emboldening
    troff: ...:15: error: cannot load font 'Z' for conditional emboldening
    troff: ...:16: error: cannot load font at position 99 for conditional
emboldening
    troff: ...:17: error: cannot load font at position 98 for emboldening
    troff: ...:18: error: cannot load font at position 98 for emboldening
    troff: ...:19: error: cannot load font 'Z' for track kerning
    troff: ...:20: error: cannot load font at position 99 for track kerning
    troff: ...:21: error: cannot load font 'Z' for constant spacing
    troff: ...:22: error: cannot load font at position 99 for constant
spacing

 ChangeLog               |  44 ++++++++++++
 src/roff/troff/node.cpp | 176
++++++++++++++++++++++++++++++++----------------
 2 files changed, 161 insertions(+), 59 deletions(-)



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62941>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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