[Top][All Lists]

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

Re: [TUHS] Re: Original print of V7 manual? / My own version of troff

From: Tadziu Hoffmann
Subject: Re: [TUHS] Re: Original print of V7 manual? / My own version of troff
Date: Wed, 10 Jan 2024 02:10:12 +0100
User-agent: Mutt/1.11.4 (2019-03-13)

[Redirected to the list, since I believe it is of general interest.]

> > Which character (slanted or upright) groff uses simply depends
> > on the mounting order of the fonts S and SS.
> > 
> > [...]

> I never knew this.  Where is the reference please?
> I would like to mention this in my new EQN manual.

The Troff User's Manual (section 2, "Font and Character Size
Control") says:

  The troff character set is defined by a description file
  specific to each output device.  There are normally several
  regular fonts and one or more special fonts.

  Troff begins execution by reading information for a set of
  defaults fonts, said to be mounted; conventionally, the first
  four are Times Roman (R), Times Italic (I), Times Bold (B),
  and Times Bold Italic (BI), and the last is a Special font (S)
  containing miscellaneous characters.  The set of fonts and
  positions is determined by the device description file.

  It is not necessary to change to the Special font;
  characters on that font are automatically handled as if
  they were physically part of the current font.  The Special
  font may actually be several fonts; the name S is reserved
  and is generally used for one of these.  All special fonts
  must be mounted after regular fonts.

However, it does not explicitly say that the special fonts
are searched in mount-position order.  (I think it is a
reasonable assumption, but I may be biased.)

The groff Info file (section 5.17.4, "Using Symbols") is more

  Here are the exact rules how 'gtroff' searches a given symbol:

   [... current font and explicit declarations using
     .char and .fspecial ...]

   * As a last resort, consult all fonts loaded up to now for
     special fonts and check them, starting with the lowest
     font number.  [...]

Since both S and SS contain lowercase Greek characters, placing
SS before S will result in gtroff picking the slanted alpha for
\(*a, whereas placing S before SS with pick the upright alpha.
(Unless of course the current font also contains a \(*a character,
in which case this will be used, or any other font declared
as special and containing \(*a is mounted before S and SS.)

> As far as I knew, there are no default fonts for 1-5 but
>   .fp 6 S
>   .fp 7 SS
> was the default as per DESC.

A reasonable default would be:

  1-4: R, I, B, BI    (standard text fonts)
  5:   CW             (computer/monospaced)
  6-9: SS, S, ZD, ZDR (special)

but this is simply convention, it is not hardcoded into groff
(and can be modified by specifying a different DESC file with a
different setup via the GROFF_FONT_PATH environment variable).

I believe the leading empty positions in the "fonts" declaration
of groff's DESC files are related to groff's extension using
"styles" and "family", which the original troff did not have.

> Where goes groff and eqn configure their font positions?

eqn itself doesn't set up any fonts, it simply requests fonts by
name or number (as specified by "gfont", "grfont", and "gbfont",
by default "I", "R", and "B", and maybe overridden by eqnrc or the
document itself) and characters by name (via builtin translation
tables or as declared via "define": "alpha" --> "\(*a" etc.).

Troff tries to satisfy these requests using the fonts it has
available/mounted, by default those from the device description
file DESC, possibly modified by troffrc (and whatever this in
turn reads), the macro package, and the document itself.

reply via email to

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