bugGNU roff - Bugs: bug #67356, tmac/fallbacks.tmac: make...

 
 

bug #67356: tmac/fallbacks.tmac: make "semantic" tty-char.tmac definitions more widely available

Submitter:  Dave <barx>
Submitted:  Fri 25 Jul 2025 09:54:51 PM UTC
   
 
Category:  Macro package - others/general Severity:  1 - Wish
Item Group:  Feature change Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Fri 01 Aug 2025 08:01:39 PM UTC, comment #2: 

For at least ps and pdf devices, font S (Symbol) is--as I deemed it in bug #63366 for lack of an official term--an extra-special font.  (To summarize 63366: special fonts are searched for a glyph if one doesn't exist in the current font.  The user can modify the list of special fonts.  An extra-special font has the former property but not the latter.)

For the purposes of the following, I am defining semantic fallbacks as those in tmac/tty-char.tmac that match this regular expression: <.+>

tty-char.tmac contains 77 semantic fallbacks.  Of these, font S contains glyphs for 69 of them.  (I determined this by using the script generated by this shell command:

egrep '<.+>' tmac/tty-char.tmac |
  sed 's/.tty-char ../grep '\''^/;
       s/\*/\\*/;
       s@\] .*@\t'\'' font/devps/S || echo NOT FOUND@'

I make no guarantees about the portability of this command to non-GNU greps and seds.)

So, for ps and pdf output, there are only 8 characters for which a user might need a semantic fallback.  Those characters, and their fallbacks as defined in tty-char.tmac, are:

.tty-char \[sc] <section>
.tty-char \[dg] <*>
.tty-char \[dd] <**>
.tty-char \[nc] <not\~superset>
.tty-char \[coproduct] <coproduct>
.tty-char \[+e] <epsilon>
.tty-char \[%0] <permille>
.tty-char \[ps] <paragraph>

For typesetter devices, we can offer far better fallbacks than most of the semantic ones above.  \[+e] can fall back to \[*e], \[nc] can be constructed by overstriking two other glyphs, etc.

So I see little benefit to making any semantic fallbacks available to ps or pdf documents.

Dave <barx>
Group Member
Mon 28 Jul 2025 02:32:17 AM UTC, comment #1: 

Throwing this on "tmac/fallbacks.tmac"'s shoulders as that seems the most logical place.  The macro file is loaded by the stock troffrc, so no new "-m" arguments would be required, and one could opt in by defining a register.


-r groff*want-semantic-fallbacks=1


Or similar.  On the downside, that proposal shoves the register name space problem back into our faces.

G. Branden Robinson <gbranden>
Group administrator
Fri 25 Jul 2025 09:54:51 PM UTC, original submission:  

Branden wrote in bug #67252 that some of the tmac/tty-char.tmac fallbacks are "suitable any time your device's fonts don't have coverage."  In particular, the ones he terms "semantic" fallbacks (e.g., "<infinity>" for \[if]) communicate useful information if the specified glyphs are unavailable, regardless of whether or not output is to a terminal (tty).

However:

  • The only place tty-char.tmac is loaded automatically is from nroff.sh.
  • The only place tty-char.tmac is documented is in comments in itself and in tty.tmac (and even there, suboptimally: bug #62814).  (See also bug #61958.)
  • Fallbacks in tty-char.tmac are defined using ".if !cA .char A B" logic.  Testing the character's existence once and then overriding it globally is suitable for a terminal device, where a glyph is either available or not on that device.  It is not suitable for a typesetter device, where fonts can change, and glyphs available in some fonts might not be in others.
  • As Branden notes in #67252, there's no clean way to separate the "semantic" fallbacks from the others; users would have to manually copy the ones they want, or edit tty-char.tmac.

So the current infrastructure effectively supports tty-char.tmac fallbacks only when running nroff.  This ticket requests making the semantic ones more widely available.

Dave <barx>
Group Member

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by barx (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-07-28 gbranden SummaryMake &quot;semantic&quot; tty-char.tmac fallbacks more widely available tmac/fallbacks.tmac: make "semantic" tty-char.tmac definitions more widely available

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code