groff
[Top][All Lists]
Advanced

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

Re: PDF reader for Groff output


From: G. Branden Robinson
Subject: Re: PDF reader for Groff output
Date: Mon, 11 Jul 2022 05:07:10 -0500

Hi Damian,

At 2022-07-11T18:15:07+1000, Damian McGuckin wrote:
> I think the issue is that the more recent packages have the Type 1
> font as a t1.

I'm not convinced that the file extension is the problem, but it does
seem like the CentOS distribution you're using is following Adobe's lead
in deprecating the Type 1 format.

https://helpx.adobe.com/fonts/kb/postscript-type-1-fonts-end-of-support.html

> Rather than screwing around with legacy packages, what is the best way
> to go from t1 to pfb please because certainly groff wants .pfb.

PFB ("Printer Font Binary") is an _encoding_ of a Type 1 font.  PFA
("Printer Font ASCII") is an alternate encoding.  They can be
interconverted.  PFB was historically more popular on MS-DOS/MS-Windows
systems, and seems to still be among TeX users.

On my system:
$ file /usr/share/fonts/type1/urw-base35/URWBookman-Demi.t1
/usr/share/fonts/type1/urw-base35/URWBookman-Demi.t1: PostScript Type 1 font 
text (URWBookman-Demi 1.00)
$ file /usr/share/groff/1.22.4/font/devps/freeeuro.pfa
/usr/share/groff/1.22.4/font/devps/freeeuro.pfa: PostScript Type 1 font text 
(FreeEuro 001.001)
$ file /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmb10.pfb
/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmb10.pfb: 
PostScript Type 1 font program data

Our documented procedures for adding fonts so that groff and the grops
output driver can use them include steps for converting PFB to PFA
format, if necessary.

The following information is from grops(1).  I'm quoting groff Git HEAD
because I think the wording is clearer, but the same substance is in the
1.22.4 man page.

       grops can embed fonts in a document that are necessary to render
       it; this is called “downloading”.  Such fonts must be in PFA
       format.  Use pfbtops(1) to convert a Type 1 font in PFB format.
       Downloadable fonts must be listed a download file containing
       lines of the form
              psname file
       where psname is the PostScript name of the font, and file is the
       name of the file containing it; lines beginning with # and blank
       lines are ignored; fields may be separated by tabs or spaces.
       file is sought using the same mechanism as that for groff font
       description files.  The download file itself is also sought using
       this mechanism; currently, only the first matching file found in
       the device and font description search path is used.
[...]
Font installation
       The following is a step‐by‐step font installation guide for
       grops.

       • Convert your font to something groff understands.  This is a
         PostScript Type 1 font in PFA format or a PostScript Type 42
         font, together with an AFM file.  A PFA file begins as follows.
                %!PS-AdobeFont-1.0:
         A PFB file contains this string as well, preceded by some non‐
         printing bytes.  If your font is in PFB format, use groff’s
         pfbtops(1) program to convert it to PFA.  For TrueType and
         other font formats, we recommend fontforge, which can convert
         most outline font formats.  A Type 42 font file begins as
         follows.
                %!PS-TrueTypeFont
         This is a wrapper format for TrueType fonts.  Old PostScript
         printers might not support them (that is, they might not have a
         built‐in TrueType font interpreter).  In the following steps,
         we will consider the use of CTAN’s BrushScriptX‐Italic font in
         PFA format.

       • Convert the AFM file to a groff font description file with the
         afmtodit(1) program.  For instance,
                $ afmtodit BrushScriptX-Italic.afm text.map BSI
         converts the Adobe Font Metric file BrushScriptX-Italic.afm to
         the groff font description file BSI.
[...]

> The question then, is where should we put them, not only for 'groff'
> but also 'okular' or 'evince' or anything else which wants them?

We can't solve the latter problem (we can't tell distributors or users
where to store their font files), but we don't need to.  groff doesn't
need the PostScript font files _except_ to embed them in the
document--that is all it ever does with them, and that procedure is
entirely handled via the "download" file.

What groff needs is a _description_ of a font in sufficient detail to
know how to render a document.  That means, for a Type 1 font, having
access to the AFM (Adobe Font Metrics) file for it.  The afmtodit(1)
program translates the information in the AFM file, plus some additional
information supplied via command-line options to afmtodit and character
encoding and glyph mapping information that is already shipped with
groff in its font/devps directory.

Deri and I have been working on improving the tooling, diagostics, and
documentation in this area lately.  I have some commits pending to
grops(1) that attempt to further elucidate the funny files lying around
in font/devps that haven't always been documented as well as they might.

Files
       /usr/local/share/groff/1.23.0/font/devps/DESC
              describes the ps output device.

       /usr/local/share/groff/1.23.0/font/devps/F
              describes the font known as F on device ps.

       /usr/local/share/groff/1.23.0/font/devps/download
              lists fonts available for embedding within the PostScript 
document (or
              download to the device).

       /usr/local/share/groff/1.23.0/font/devps/text.enc
              describes the encoding scheme used by most PostScript Type 1 
fonts; the
              encoding directive of font description files for the ps device 
refers to it.

       /usr/local/share/groff/1.23.0/font/devps/generate/dingbats.map
       /usr/local/share/groff/1.23.0/font/devps/generate/dingbats-reversed.map
       /usr/local/share/groff/1.23.0/font/devps/generate/slanted-symbol.map
       /usr/local/share/groff/1.23.0/font/devps/generate/symbol.map
       /usr/local/share/groff/1.23.0/font/devps/generate/text.map
              map names in the Adobe Glyph List to groff special character 
identifiers for
              Zapf Dingbats (ZD), reversed Zapf Dingbats (ZDR), symbol (S), 
slanted symbol
              (SS), and text fonts, respectively.  These map‐files are used to 
produce the
              font description files provided with groff for the grops output 
driver.

Please advise me of any gaps you note in the above information.  I think
most groff users over the years have regarded this stuff as voodoo, and
I'd very much like to demystify it.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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