Subject: comp.fonts FAQ: Utilities
From: [email-masked] (Norman Walsh)
Date: 14 Aug 1996 10:35:35 -0400
Newsgroups: comp.fonts,comp.answers,news.answers

Archive-name: fonts-faq/part16
Version: 2.1.5

Subject: 11. Utilities Information
  
  I have just started collecting information about font utilities.  I
  will gladly add any information that you can pass my way.  Please send
  your submissions to norm.
  
  I would appreciate it if you could include a paragraph or so of
  description and the appropriate site/filename for retrieval.
  
Subject: 11.1. How do I convert AFM files to PFM files
  
  You can get afm2pfm and pfm2afm files from
  http://www.ora.com/homepages/comp.fonts/FAQ-tools.html.
  
Subject: 11.2. PS2PK
  
  PS2PK is a utility for converting Type1 postscript fonts into TeX PK
  files.  The source code is distributed and it has been compiled for
  both *nix boxes and MS-DOS based machines.
  
  Here is the original announcement:
  
                            Ps2pk-1.2 available
                            -------------------
                                 (June 1992)
       
       Version 1.2 of ps2pk is now available on:
       ftp.urc.tue.nl (address: 131.155.2.79)
       directory:    /pub/tex
       files:        ps2pk12.README         (  1k)    This file
                     ps2pk12.tar.Z          (391k)    Sources
                     ps2pk386.zip           (232k)    MSDOS executables
                     utopia.tar.Z           (342k)    Adobe Utopia font family
                     courier.tar.Z          (207k)    IBM Courier font family
       
       For people having difficulties in handling UNIX `.tar.Z' format I
       have made some UNIX tools (only executables) available in:
       directories:  /pub/unixtools/dos
                     /pub/unixtools/vms
       
       See the system specific TARZ file for some help.
       
       Ftp.urc.tue.nl can not handle E-mail requests. But sites are free
       to put the ps2pk12 stuff on any server that can.
  
  When do you need ps2pk?
  =======================
  
  Ps2pk is a tool that converts a PostScript type1 font into a corres-
  ponding TeX PK font.  The tool is especially interesting if you want to
  use fully hinted type1 fonts in your DVI previewer (instead of the
  unhinted type1 fonts currently used in GhostScript) or on a printer
  that has no PostScript interpreter.
  
  In order to use the ps2pk generated fonts your driver and previewer need
  to support virtual fonts.  The reason is that PostScript fonts and TeX
  fonts do have a different font encoding and handle ligatures in a
  different way.  With virtual fonts the PostScript world (encoding +
  ligatures) can be mapped to the old style TeX world on which the current
  plain macro packages still are based (despite the fact that TeX3.0 can
  handle 8bits).
  
  It is also possible to use the ps2pk generated PK fonts directly
  
Subject: 11.3. TeX Utilities
  
  There are many TeX font utilities.  For TeX related questions, I direct
  you to comp.text.tex or the Info-TeX mailing list.  I will happily list
  any utilities here that the comp.fonts public feels should be present.
  I am listing MetaFont because it is the obvious font-specific component
  of TeX and PKtoSFP because it allows anyone to use PS2PK to create
  LaserJet softfonts.
  
  Liam R. E. Quin is the original author of the MetaFont section.  It has
  been hacked at a bit by norm to make it fit the tone of the comp.fonts
  FAQ.  Assume that norm is responsible for any errors, not Liam.
  
  MetaFont
  ========
  
  About MetaFont:
  ---------------
  
  Metafont is a programming language for describing fonts.  It was
  written by Donald Knuth and is documented in
  
         Computers & Typesetting/C: The METAFONTbook
         Knuth, Donald E.
         Addison Wesley, 1986
         ISBN 0-201-13445-4, or 0-201-13444-6 (soft cover)
         Library access: Z250.8.M46K58, or 686.2'24, or 85-28675.
  
  A font written in MetaFont is actually a computer program which, when
  run, will generate a bitmap (`raster') for a given typeface at a given
  size, for some particular device.
  
  What do you need in order to use the fonts:
  -------------------------------------------
  
  You cannot print the MetaFont fonts directly (unless you want a listing
  of the program, that is).  Instead, you must generate a bitmap font and
  use that to print something.
  
  If you are using TeX, the sequence of steps is something like this:
  
  MF to MetaFont to GF
       Convert a MetaFont program into a bitmapped font.  Also produces a
          TFM file.
  
  MF to MetaFont to TFM
       Covnert a MetaFont program into a TFM file.  Also produces     a
       GF bitmapped font.
  
  GF to GFtoPK to PK
       Convert a GF bitmapped font into a compressed PK font.
  
  TEX + TFM to TeX to DVI
       Produce a device independent output file.
  
  DVI + PK to dvi driver to output format
       Produce a device-specific output file (or preview).
  
  The above steps are idealized.  In reality, you have to make sure that
  the fonts get installed in the correct places and you may have to
  adjust description files, etc.  The friendly folks on comp.text.tex can
  probably get it staightened out for you if you can't find a local guru.
  
  If you are not using TeX, it's almost impossible to predict.  At some
  point in the above sequence, you'll insert some other conversion
  program and proceed differently.  Here, for example, is how you might
  use TeX fonts with WordPerfect and a LaserJet printer.
  
  PK to PKtoSFP to SFP
       Convert a TeX PK file into an HP LaserJet softfont.
  
  SFP to SFP2Auto to TFM
       Make HP AutoFont Tagged Font Metric file.
  
  SFP + HP AutoFont TFM to PTR to Installed in WP
       Install the new font in WordPerfect.
  
  Use WordPerfect as you normally would.
  
Subject: 11.4. MFPic
  
  MFpic is a macro package for including pictures in TeX documents.  The
  idea behind this package is to have Metafont do the actual drawing, and
  store the pictures in a font that TeX can include in the document.  The
  macros have been designed so that the user should never have to learn
  Metafont to use these macros--the TeX macros actually write the
  Metafont file for you.
  
Subject: 11.5. fig2MF
  
  Briefly, fig2MF uses the mfpic macros to create formatted, commented MF
  code from the fig graphics language. This means that programs like xfig
  can be used as interactive font creation tools. I wrote fig2MF so that
  I could portably illustrate TeX documents, but I suppose one could use
  it to design letterforms as well.
  
  The package consists of a single C source code file, modified mfpic
  macros, documentation, and sample fig files.  It is available at the
  shsu archives.
  
Subject: 11.6. GNU Font Utilities
  
  Here is a brief description of the programs included:
  
     * imageto extracts a bitmap font from an image in PBM or IMG format,
       or   converts the image to Encapsulated PostScript.
  
     * xbfe is a hand-editor for bitmap fonts which runs under X11.
  
     * charspace adds side bearings to a bitmap font.
  
     * limn fits outlines to bitmap characters.
  
     * bzrto converts a generic outline font to Metafont or PostScript.
  
     * gsrenderfont renders a PostScript outline font at a particular
       point   size and resolution, yielding a bitmap font.
  
     * fontconvert can rearrange or delete characters in a bitmap font,
       filter them, split them into pieces, combine them, etc., etc.
  
     * imgrotate rotates or flips an IMG file.
  
  We need volunteers to help create fonts for the GNU project.  You do not
  need to be an expert type designer to help, but you do need to know
  enough about TeX and/or PostScript to be able to install and test new
  fonts.  Example: if you know neither (1) the purpose of TeX utility
  program `gftopk' nor (2) what the PostScript `scalefont' command does,
  you probably need more experience before you can help.
  
  If you can volunteer, the first step is to compile the font utilities.
  After that, contact me [ed: Karl Berry] ([email-masked]).  I will
  get you a scanned type specimen image.  The manual explains how to use
  these utilities to turn that into a font you can use in TeX or
  PostScript.
  
  You can get the source by ftp from any GNU archive site.
  
  You can also order tapes with GNU software from the Free Software
  Foundation (thereby supporting the GNU project); send mail to
  [email-masked] for the latest prices and ordering information, or
  retrieve the file DISTRIB from a GNU archive.
  
  This is Info file compfont.info, produced by Makeinfo-1.55 from the
  input file FAQ.texinfo.
  
Subject: 11.7. Font Editors
  
     * Editors for BDF fonts
  
       There is a bdf font editor that comes with HP/Apollo workstations.
       It's called 'edfont'.  It's not the best but it works.
  
       Gary reports:
  
       The standard X distribution for X11R5 contains "xfed", which
       allows you to play with BDF fonts.  "xfedor" has a more elaborate
       user interface, and is available on most contrib directories.
  
       The last time I tried:
  
       "xfedor" couldn't handle BDF files with more than 256 characters.
  
       "xfed" aborts if the BDF file contains a COMMENT line with no other
       text.  The workaround is to edit the BDF file, to put text after
       the word COMMENT.  A single blank space is sufficient.  For some
       reason, the standard BDF files included in the X release contain
       blank spaces on the otherwise empty COMMENT lines.  It was
       probably easier to add the space to the COMMENT lines of every BDF
       file than it was to fix the lex code for xfed.  :-)
  
     * Editors for PK fonts
  
       The GNU font utilities include an X-based editor called Xbfe which
       edits bitmapped fonts under X.
  
       Eberhard Mattes' emTeX includes PKedit.
  
Subject: 11.8. The T1 Utilities
  
  This is a snippet from the README file for I. Lee Hetherington's
  t1utils package:
  
  t1utils is a collection of simple type-1 font manipulation programs.
  Together, they allow you to convert between PFA (ASCII) and PFB
  (binary) formats, disassemble PFA or PFB files into human-readable
  form, reassemble them into PFA or PFB format.  Additionally you can
  extract font resources from a Macintosh font file (ATM/Laserwriter).
  
Subject: 11.9. Where to get bitmap versions of the fonts
  
  There are archives containing the bitmaps of many of these fonts at
  various sizes and resolutions.  The fonts must have been generated for
  the correct print engine: e.g. write-white or write-black.  The
  archives generally hold only the sizes used by TeX.  These are
  `magstep' sizes, and are not exact point sizes.  It is probably better
  to generate them from the Metafont sources yourself if you can.
  
  The best place to look for raster fonts was almost certainly:
  mims-iris.waterloo.edu
  
  but it isn't any more, the fonts have all gone.  Let me know if you
  find them elsewhere.  Most people seem to have moved to using
  PostScript fonts or Bitstream ones instead now.
  
  Some other sites are:
  
         ftp.cica.indiana.edu
         mac.archive.umich.edu
         ftp.shsu.edu
         ftp.tex.ac.uk
         ftp.dante.de
  
  The occasional posting of ftp sites to comp.misc and comp.archives
  lists these and several other sites.
  
Subject: 11.10. Converting between font formats
  
  Conversions to and from pbm and pk format were posted to comp.text.tex
  and to alt.sources on the 9th of August, 1990 by Angus Duggan.  The
  program is pbmtopk, and there are also at least two patches.
  
  Chris Lewis' psroff package includes a program to go from pk both to
  the HP LaserJet and to PostScript.
  
  John McClain <[email-masked]> has some conversion programs for
  various graphics formats to/and from pk files.
  
  A PC program, CAPTURE, turns HPGL files into PK format, US$130 from
  Micro Programs Inc., 251 Jackson Ave., Syosset, NY 11791 U.S.A.
  
  Metaplot can take pen-plotter files and prouce metafont files.  Note:
  Pat Wilcox is no longer at Ohio State.
  
  Kinch Computer Company sell .pk fonts derived from PostScript fonts.
  Kinch Computer Co., 501 S. Meadow St.Ithaca, NY 14850 U.S.A.
  telephone: +1 607 273 0222; fax: +1 607 273 0484
  
Subject: 11.11. Getting fonts by FTP and Mail
  
  If you are using ftp, you will need either the name of the host or the
  Internet number.  For example, to connect to ftp.ora.com, listed as
  ftp: ftp.ora.com [198.112.208.11] you will need to type something like
  
                              ftp ftp.ora.com
  
  If that doesn't work, try using the number:
  
                            ftp 198.112.208.11
  
  If that doesn't work, on Unix systems you can use nslookup (it's
  usually /usr/etc/nslookup) to find the host number - it might have
  changed.  Type the entire host name, and after a few seconds nslookup
  will give you the address.  Of course, if you have nslookup installed,
  the first form will probably work...
  
  Once you have connected, you will need to go to the appropriate
  directory, lists its contents, and retrieve the files.
  
  Most of the machines listed here run Unix, and you use "ls" and "cd" to
  list files and to change directories.  On machines that run VMS, you
  will have to put square brackets around directory names, like [this].
  
  Remember that although Metafont sources are text files, pk fonts are
  not ASCII, and you will have to use binary mode for them.  In general,
  use text mode for README files and *.mf files, and binary mode for
  other font files.  Files ending in .Z are compressed binary files - you
  will need to use binary mode, and then uncompress the files when you
  get them.
  
  There is an ftp-by-mail BITNET service, BITFTP, for BITNET users.
  
  Before getting large files by mail, please remember to get permission
  from all intervening sites.  Ask your site administrator, who can send
  mail to Postmaster at each site on the way if necessary.
  
Subject: 11.12. MetaFont to PostScript Conversion
  
  There are (I believe) three programs that perform this task.  At least
  one of them is called "mf2ps".  If you have any more information about
  these tools, please let me know.
  
  Chang Jin-woong reports that he found the "mf2ps" package with Archie.
  It is written by Shimon Yanai <[email-masked]> and Daniel M.
  Berry <[email-masked]>. The source programs are written in
  Pascal.
  
  MetaFog, a commercial conveter by Richard Kinch, is available on request
  to TrueTeX owners.
  
Subject: 11.13. How to use Metafont fonts with Troff
  
  If, when you run troff, you get the message `typesetter busy', you have
  the original Ossanna-troff, also called otroff.  Chris Lewis has a
  package which will let you use TeX fonts with troff - it's called
  psroff, and comes with documentation.
  
         ftp: gatekeeper.dec.com (16.1.0.2) pub/misc/psroff-3.0
         ftp: ftp.cs.toronto.edu [128.100.1.105] pub/psroff-3.0/*
  
  If, when you run troff, you get something like this:
  
         x T 300
         x res 300 1 1
  
  you have ditroff.  This is sometimes called titroff or psroff.  In this
  case, you will probably need to do the following:
  
    1. convert the font to your printer's format
  
    2. generate a width table for the font
  
    3. add the font to the DESC file for the appropriate device
  
    4. arrange for troff to download the font
  
    5. tell troff about the font by running `makedev DESC' in the
       right place.
  
  If, when you run troff, you get something like this:
  
         X hp(SCM)(CM)(AF)(AD) 300 1 1
         Y P default letter 2550 3300 0 0 90 90 2460 3210
  
  you have sqtroff:
  
    1. convert the font to your printer's format
  
    2. generate a width table for the font
  
    3. add the font to the DESC file for the appropriate device
  
    4. put the font in the appropriate raster directory
  
    5. tell sqtroff about the font by running `sqmakedev DESC' or
       `sqinstall'.
  
  In each case, you should be able to get help from your vendor.
  
  Note that Chris Lewis' psroff package has software to make width tables
  for troff from pk files.
  
Subject: 11.14. PKtoBDF / MFtoBDF
  
  From the SeeTeX distribution, programs to help previewers under X11.
  They convert TeX PK files into X11 BDF fonts (which can be further
  converted into one or more server native formats).
  
Subject: 11.15. PKtoPS
  
  Included in the psroff distribution, this utility converts PK fonts
  into PostScript fonts (bitmaps, I presume).  If you have any more
  information about these tools, please let me know.
  
Subject: 11.16. PKtoSFP / SFPtoPK
  
  Convert fonts from TeX PK format to HP LaserJet softfont (bitmap)
  format.
  
Subject: 11.17. PostScript to MetaFont
  
  ps2mf started out as a way of creating bitmaps via MF for TeX. Only,
  when I had just finished it, Piet Tutelaers came with ps2pk. This was a
  far superior way runtime-wise. He uses the IBM X11-R5 fontutilities
  library, which is extremely ugly code. But, it works. So, to generate
  bitmaps, I suggest everyone use ps2pk.
  
  To generate a MF outline description, ps2mf is *the* tool. Yannis
  Haralambous has just started a project where he wants to create
  meta-ized fonts for MF from Postscript descriptions. ps2mf does the
  basic conversion. This project wants to revive the use of MF for it is
  a truly beautiful program with enormous possiblities.
  
  The following information comes from the README file for ps2mf:
  
  This is pfb2mf. It is a copyleft program. See the file COPYING for more
  details. I suggest that for the translation of Type-One to readable
  PostScript you use I. Lee Hetherington's Type-1-Utils. You can find
  these somewhere on obelix.icce.rug.nl in pub/erikjan.
  
  If you find any bugs, please do report.
  
  If you have any complaints, please do report.
  
  Now for some info about the different stages. This package contains
  four programs:
  
     * pfb2pfa
  
     * pfa2chr
  
     * chr2ps
  
     * ps2mf
  
  pfb2pfa
  =======
  
  pfb2pfa will decompress an IBM (!) Postscript type 1 fontfile into
  readable           and downloadable hexadecimal data.
  
  The resulting file still contains two layers of encryption:
  
     * eexec encryption
  
     * charstring encryption
  
  pfa2chr
  =======
  
  pfa2chr will do an eexec-decryption of a readable hexadecimal font file
  to a   fontfile with encrypted charstrings.
  
  chr2ps
  ======
  
  chr2ps will perform a charstring-decryption of a font file with
  encrypted   charstrings to fontfile with postscript commands for type 1
  fonts.
  
  With a "-" as filename, these programs will read from <stdin> and write
  to <stdout>. This way you can pipe the results, as in:
  
         pfb2pfa garmnd - | pfa2chr - - | chr2ps - garmnd
  
  This will create a garmnd.ps from garmnd.pfb without explicitely
  creating the intermediate files.
  
  These previous stages can be replaced by (when using Lee Hetherington's
  type-1-utils):
  
  t1disasm garmnd.pfb garmnd.ps
  
  ps2mf
  =====
  
  This last stage will convert to a MetaFont program with the use of the
  corresponding .afm file and a mapping configuration file. It can
  convert   to an ordinary form with Bezier controlpoints. It can also
  generate a curl   specification. For this last option specifify -C.
  
Subject: 11.18. Mac Bitmaps to BDF Format
  
  I [ed: who?] have posted a program which I hacked together for
  extracting all NFNT and FONT resources from a MacBinary form of a
  standard Mac file and dumping the fonts as Adobe BDF files.  It has only
  been compiled and tested on a Sun system to date.  It can be fetched
  from METIS.COM, /pub/mac2bdf.c.
  
  I wrote this tool to be able to use Mac Bitmaps under X Windows and
  OpenWindows (which take Adobe BDF format files).