groff
[Top][All Lists]
Advanced

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

Re: [Groff] Re: Adding styles to DESC


From: Werner LEMBERG
Subject: Re: [Groff] Re: Adding styles to DESC
Date: Fri, 11 Jun 2004 10:45:16 +0200 (CEST)

> I don't suppose it's an easy thing to change .fam so that a change
> in family doesn't take effect until the next .ft request?  This is
> an issue that's puzzled me ever since making the transition from
> SoftQuad troff to groff.  As far as I know, sqtroff originated the
> whole idea of a .fam request (theirs was .ffam) and I'm pretty sure
> they specified the above effect.

If you compare this to the LaTeX font selection scheme, I think that
the behaviour of .fam and .ft as implemented currently is the right
one.

LaTeX provides a full featured scheme with four components (which is
still not enough, as has been argued many times on the LaTeX mailing
lists): font encoding, family, series (bold, condensed, etc.), and
shape (upright, italic, slanted, etc.).  They can be switched
independently.

groff has a simpler scheme with only two elements: family and style;
the latter is kind of a combination of LaTeX's series and shape
components.  Font encoding is not an issue for groff since font
definition files aren't limited to 256 glyphs, and glyphs are accessed
with glyph names internally.

`.ft' selects the style, and `.fam' selects the family.  Similar to
LaTeX, `.ft' and `.fam' independently select the components of the
file name [*]:

  .fam T
  .ft R   \" -> TR
  .fam H  \" -> HR
  .ft B   \" -> HB

LaTeX actually has a command \selectfont until which changes of the
font name components are delayed, but this can't be compared to the
groff case IMHO since both .ft and .fam act immediately.

If you want a delayed font selection, you have to implement it as
macros.  Example:

  .fp 0 dummy TR
  .
  .de set-style
  .  ds @style \\$1
  ..
  .
  .de set-family
  .  ds @family \\$1
  ..
  .
  .de set-font
  .  ft 0
  .  fam address@hidden
  .  ft \\*[style]
  ..

`.FT' could then be a shorthand:

  .de FT
  .  set-style \\$1
  .  set-font
  ..

I hope this clarifies groff's font selection.


     Werner


[*] The exact behaviour is as follows:

  .fam F

    Set family component to <F>.  If the current font position is
    associated with style <s>, select the font <F><s>.  In case <F><s>
    doesn't exist, ignore the call to .fam (but save the used family
    name to suppress consequent warnings).  If the current font
    position is associated with a real font, no font change happens.

  .ft s

    If <s> is not a style name, switch to font <s>.  If <s> is a
    style, switch to <F><s>, where <F> is the current font family.  If
    the font to be selected doesn't exist, ignore the call to .ft (but
    save the used font name to suppress consequent warnings).

  Example:

      .fam T
      .ft R            \" -> TR
      .fp 0 dummy TR   \" -> TR
      .sty \n[.fp] RO  \" -> TR
      .fam EU          \" -> TR (can't find font `EUR')
      .ft RO           \" -> TR (can't find font `TRO')
      .ft 0            \" -> dummy
      .fam EU          \" -> dummy (no additional warning)
      .ft BU           \" -> dummy (can't find font `BU')
      .ft RO           \" -> EURO


reply via email to

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