groff
[Top][All Lists]
Advanced

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

Re: [Groff] fontselection


From: Tadziu Hoffmann
Subject: Re: [Groff] fontselection
Date: Fri, 5 Apr 2002 11:13:38 +0200

> > >some text \f(CRmore text\fP original font.
> >
> > This is convincing, you are using the different syntax
> > [\f(xx vs. \fN] to get a sort of start- and end-tag which
> > in combination with syntax highlighting facilitates
> > reading the source code.  (I'm using VIM.)
> 
> To use the \f[...] escapes has distinct advantages when
> using scripting to translate for SGML/XML. It suits the
> begin tag/end tag philosophy... Also, it can be hard to
> convince XSLT to begin macros and requests at the beginning
> of lines.


Yes, but I think it's not such a good idea when writing *roff
code by hand.  I tend to use the method implemented in the
manpage macros, i.e., in the manuscript use high-level macros
which themselves refer to the fonts by font position.  Then
you don't have to decide in advance which specific fonts to
set your manuscript in.

For example (I have renamed the fonts to more sensible names
in my installation),

  .fp 1 R  Helvetica
  .fp 2 I  Helvetica-Oblique
  .fp 3 B  Helvetica-Bold
  .fp 4 BI Helvetica-BoldOblique
  .fp 5 C  Courier-Bold

and then use a macro "I" to print its argument in the font
at position 2 (possibly with auto-concatenation of remaining
arguments in the current font):

  I write all my texts with
  .I vim .

Such a scheme is very useful for an "emphasize" macro, which
tests whether the current font is 1 or 3, and then selects
font 2 or 4 accordingly (and vice versa).  Then you can say

  .EM "emphasized text"

irrespective of whether you emphasizing something in the
normal text (non-bold) or within a section header (which
I usually set in bold).

If, after all, I decide not to print my text in Helvetica, but
instead in New Century Schoolbook, I only have to replace the
four lines above.  (Actually, I do this with a macro which
takes the font family name as argument, so I only have to
change one line.)

  .fp 1 R  NewCenturySchlbk-Roman
  .fp 2 I  NewCenturySchlbk-Italic
  .fp 3 B  NewCenturySchlbk-Bold
  .fp 4 BI NewCenturySchlbk-BoldItalic

No other changes to the manuscript are necessary.


(Okay, to be fair, saying \fIvim\fP would also work correctly,
because .fp with three arguments makes the second an alias
for the third.  However, that still doesn't give you the
functionality of an emphasize macro, or things like italic
correction which can be automatically provided by macros.)




reply via email to

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