groff
[Top][All Lists]
Advanced

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

Re: [Groff] fontconfig


From: Larry Kollar
Subject: Re: [Groff] fontconfig
Date: Mon, 2 Mar 2015 22:33:40 -0500

> On Mar 2, 2015, at 6:01 PM, SGT. Garcia <address@hidden> wrote:
> 
> is it possible to use fontconfig font families with groff? google is
> failing to find anything.

I think not. Groff (and other *roff variants) have their own directories and 
special file formats for font metrics—the data that determines how much space a 
glyph needs, whether it can be kerned with certain other glyphs, and so on.

Having said that, if fontconfig can do the donkey work of adding a font to 
Ghostscript, there are programs that can generate the proper font metric files 
for groff (for example, afmtodit for PostScript). If you don’t have the metric 
file (usually *.afm), you can use pf2afm(1) to generate the metrics from the 
PostScript font itself.

Groff fonts typically live in /usr/local/share/groff/[version]/font/devps; on 
my iMac, the actual path is /usr/share/groff/1.22.3/font/devps. You’ll find a 
bunch of files with names like BMR and PBI in here. The file names always end 
with R, I, B, or BI (regular, italic, bold, and bold-italic respectively). The 
rest of it is the font family—BM for Bookman, P for Palatino, T for Times, and 
so on.

In Groff itself, there are two ways to specify which font you actually want:

1) Specifying a family name with .fam and using the conventional .B, .I, etc 
macros, like this:

.fam P
This text is Palatino regular now.
.I Palatino-Italic
and
.B Palatino-Bold

2) Specifying the entire font name:

.ft PR
This text is Palatino regular now.
.ft PI
Palatino-Italic
.ft
and
.ft PB
Palatino-Bold
.ft

(The .ft request with no arguments reverts to the previous selection.)

If you’re using groff -ms, you should set the FAM string to specify the family. 
This is important, because -ms resets a bunch of defaults at every paragraph 
and heading. For example:

.ds FAM P
.LP
This document uses the Palatino font.
.ds FAM A
We’ve now switched to Avant Garde, but the change won’t take effect
until the next paragraph.
.LP
Now we’re using Avant Garde.

That should get you started. You can experiment with different fonts to see 
which ones you like best.

— Larry


reply via email to

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