[Top][All Lists]

[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 07:59:53 +0200 (CEST)

> At any rate, /site-font is something I've always wanted, so I'll
> create the dir myself.  Still, it would be interesting to know why
> it wasn't created by default during make/make install.

Because there was no rule. :-) Now there is.  Thanks for the report.

> >      The `styles' command in the `DESC' file controls which font
> >      positions (if any) are initially associated with styles rather
> >      than fonts.  For example, the default setting for POSTSCRIPT
> >      fonts
> >
> >           styles R I B BI
> >
> >      is equivalent to
> >
> >           .sty 1 R
> >           .sty 2 I
> >           .sty 3 B
> >           .sty 4 BI
> It was this very same snippet from the info file that lead me
> astray.  I misread " equivalent to" as meaning "is equal to"
> (IOW as an operator).  If "styles <whatever>" = ".style n <whatever>",
> then ".style n <whatever> = styles <whatever)" (provided that the
> "fonts" line in DESC matched up in terms of number of fonts).

If you can provide a better formulation which avoids this misleading
possibility, please do so -- English isn't my mother tongue...

> What I'm wondering, then, is: would there be a problem with adding
> these (and other) styles to om.tmac (with .sty), then re-writing the
> .FAMILY macro so that whenever it's called, it precedes the .fam
> call with .ft R?  If there isn't a problem, I can then expand the
> .FAMILY section of the momdocs, instructing mom users how to add
> entire font families using naming conventions like the above.

Preceding with .ft R might fail in case the user has selected a font
family which doesn't have an `R' style.  This is not as unlikely as it
appears -- in LaTeX, *all* fonts get both a `shape' and a `family' tag
(and a `series' tag).  For example, ZapfChancery is family `pzc' and
shape `it' (for italic), and there is no other member in the
ZapfChancery family.

Let's assume that you catch this, for example, by providing a .FONT
macro which tests whether its argument is a style (by comparing with
register `.fn'), and which sets a variable `style' accordingly.  Then
you can do something like this:

  .fp 0 dummy TR       \" at start-up time of mom
  .de FAMILY
  .  ft 0              \" switch to font which is always valid
  .  fam \\$1
  .  \" test whether last font was a style
  .  ie '\*[style]'' \
  .    FONT R
  .  el \
  .    FONT

As trivial as the font selection mechanism in groff seems to be, it
can be tricky to catch errors, providing meaningful defaults and
warning messages.

What do you think about adding two conditional tests like this:

  .if F <font>   \" true if <font> can be found by troff --
                 \" the font isn't loaded
                 \" if <font> is a style, and the style is registered,
                 \" and <family> is the current family,
                 \" test whether concatenation of <family> and <font>
                 \" exists

  .if S <style>  \" true if <style> has been registered, either via
                 \" the DESC file or with .sty

I think this would help a lot in implementing a better font selection
scheme, and it should be rather easy to add to troff.


reply via email to

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