[Top][All Lists]

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

Re: [Groff] Adding fonts to groff -- instructions?

From: Zvezdan Petkovic
Subject: Re: [Groff] Adding fonts to groff -- instructions?
Date: Sat, 11 Mar 2006 04:24:25 -0500
User-agent: Mutt/1.4.2i

On Sat, Mar 11, 2006 at 05:19:27PM +1100, Robert Marks wrote:
> Although I've been using t/groff for almost 30 years (all my
> word/text processing, including letters (with PostScript
> letterheads), memos, academic papers, and lecture handouts and PDF
> overheads (using the present package for the mm macros), using
> PostScript output to the printer and for making PDFs,
> I have never added a font to groff myself.

That's generally a good approach.
Don't do something unless you really need it.

> Now I want to add an ESSTIX font (which comes with .pfb, .afm, .pfm,
> and .ttf files) and the only doc I can find is in the momdoc appendices,
> at
> but registration of the new font is Debian-specific.

This is a good information.
You may want to disregard some of it since you have afm files already.

I recently wanted to use with my slides a TrueType font for monospaced
text (program code) that is used in the figures in the book I teach

Funny thing is that I am on the list of credits for ttf2pt1,
yet I didn't feel like compiling it so I rather used ttf2afm
(part of pdfTeX) which is installed on most UNIX systems.

Once I had afm files the procedure was simple.

> Are there any more general instructions?  Have I missed some?

I don't claim that these are general but they are short and

I assume that the latest groff version is installed in $HOME/opt/,
so $GROFF=$HOME/opt/share/groff, and actual fonts are in
I also assume that Ghostscript is installed.

1. mkdir $GROFF/site-font/devps
2. cd $GROFF/site-font/devps
3. For each .ttf file run
        ttf2afm $HOME/.fonts/TrueType/fontname.ttf -o fontname.afm
4. For each .afm file run
        afmtodit -e text.enc fontname.afm textmap FN
   where FN is the font name groff will use.
   For example, I chose LGR as a name for LetterGothic Regular.
   I added -i option for italic and -n for monospaced fonts
   (see man page).
   I removed *.afm files from $GROFF/site-font/devps
4. cd $HOME/.fonts
5. create Fontmap directory in $HOME/.fonts with entries such as
        % Aliases
        % ...
        /LetterGothic                   /LetterGothic-Reg       ;
        /LetterGothic-Roman             /LetterGothic-Reg       ;
        /LetterGothic-Italic            /LetterGothic-Ita       ;
        /LetterGothic-Bold              /LetterGothic-Bol       ;
        /LetterGothic-BoldItalic        /LetterGothic-BolIta    ;
        % ...
6. put these three lines in $HOME/.profile (or equivalent for .login)
        export GS_FONTPATH GS_LIB

Now, groff sees my LGR, LGI, LGB, and LGBI fonts since they are in the
standard groff path.
Ghostscript can also see them thanks to the environment variables set up
in .profile.  It embeds them in PDF perfectly fine.
Thanks to the aliases, Ghostscript can use them for the EPS files from
the book too.
As an added benefit, since fonts are in $HOME/.fonts I have them
available even for my X applications by defining $HOME/.fonts.conf file
with an entry:
        <?xml version="1.0"?>
        <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
        <!-- ~/.fonts.conf file to configure personal font additions -->
                <!-- 8< -->
                <!-- >8 -->
                <!-- Monospace faces -->
                <!-- 8< -->
                <!-- >8 -->

Now I can start
        xterm -fa LetterGothic
if I feel so inclined.
I don't.

I hope this helps.
All the best.

        Zvezdan Petkovic

reply via email to

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