aboutsummaryrefslogtreecommitdiff
path: root/en
diff options
context:
space:
mode:
Diffstat (limited to 'en')
-rw-r--r--en/tutorials/fonts/fonts.docb201
1 files changed, 193 insertions, 8 deletions
diff --git a/en/tutorials/fonts/fonts.docb b/en/tutorials/fonts/fonts.docb
index c7e8221d43..75d01279be 100644
--- a/en/tutorials/fonts/fonts.docb
+++ b/en/tutorials/fonts/fonts.docb
@@ -1,4 +1,4 @@
-<!-- $Id: fonts.docb,v 1.2 1998-06-26 10:47:27 jkoshy Exp $ -->
+<!-- $Id: fonts.docb,v 1.3 1999-08-06 17:35:18 nik Exp $ -->
<!-- The FreeBSD Documentation Project -->
<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN">
@@ -629,8 +629,199 @@ bash$ <userinput>lpr -Ppostscript example.ps</></screen>
</chapter>
+ <chapter>
+ <title>Converting TrueType fonts to a groff/postscript format for
+ groff</title>
+
+ <para>This potentially requires a bit of work, simply because it
+ depends on some utilities that are not installed as part of the
+ base system. They are:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><command>ttf2pf</command></term>
+
+ <listitem>
+ <para>TrueType to postscript convertsion utilities. This
+ allows conversion of a TrueType font to an ascii font
+ metric (<filename>.afm</filename>) file.</para>
+
+ <para>Currently available at <ulink
+ url="http://sunsite.icm.edu.pl/pub/GUST/contrib/BachoTeX98/ttf2pf/">http://sunsite.icm.edu.pl/pub/GUST/contrib/BachoTeX98/ttf2pf</ulink>.
+ Note: These files are postscript programs and must be
+ downloaded to disk by holding down the
+ <keycap>Shift</keycap> key when clicking on the
+ link. Otherwise, your browser may try to launch
+ <application>ghostview</application> to view them.</para>
+
+ <para>The files of interest are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><filename>GS_TTF.PS</filename></para
+ </listitem>
+
+ <listitem>
+ <para><filename>PF2AFM.PS</filename></para>
+ </listitem>
+
+ <listitem>
+ <para><filename>ttf2pf.ps</filename></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The funny upper/lower case is due to their being
+ intended also for DOS shells.
+ <filename>ttf2pf.ps</filename> makes use of the others as
+ upper case, so any renaming must be consistent with
+ this. (Actually, <filename>GS_TTF.PS</filename> and
+ <filename>PFS2AFM.PS</filename> are supposedly part of the
+ ghostscript distribution, but it's just as easy to use
+ these as an isolated utility. FreeBSD doesn't seem to
+ include the latter.) You also may want to have these
+ installed to
+ <filename>/usr/local/share/groff_font/devps</filename>(?).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><command>afmtodit</command></term>
+
+ <listitem>
+ <para>Creates font files for use with groff from ascii font
+ metrics file. This usually resides in the directory,
+ <filename>/usr/src/contrib/groff/afmtodit</filename>, and
+ requires some work to get going.</para>
+
+ <note>
+ <para> If you're paranoid about working in the
+ <filename>/usr/src</filename> tree, simply copy the
+ contents of the above directory to a work
+ location.</para>
+ </note>
+
+ <para>In the work area, you'll need to make the
+ utility. Just type:</para>
+
+ <screen>
+<prompt>#</prompt> <userinput>make -f Makefile.sub afmtodit</userinput>
+ </screen>
+
+ <para>You may also need to copy
+ <filename>/usr/contrib/groff/devps/generate/textmap</filename>
+ to
+ <filename>/usr/share/groff_font/devps/generate</filename>
+ if it doesn't already exist.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Once all these utilities are in place, you're ready to
+ commence:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Create the <filename>.afm</filename> file by
+ typing:</para>
+
+ <screen>
+<prompt>%</prompt> <userinput>gs <optional>-dNODISPLAY</optional> <optional>-q</optional> -- ttf2pf.ps <replaceable>TTF_name</replaceable> <optional><replaceable>PS_font_name</replaceable> <optional><replaceable>AFM_name</replaceable></optional></optional></userinput>
+ </screen>
+
+ <para>Where, <replaceable>TTF_name</replaceable> is your
+ TrueType font file, <replaceable>PS_font_name</replaceable>
+ is the file name for the <filename>.pfa</filename> file,
+ <replaceable>AFM_name</replaceable> is the name you wish for
+ the <filename>.afm</filename> file. If you do not specify
+ output file names for the <filename>.pfa</filename> or
+ <filename>.afm</filename> files, then default names will be
+ generated from the TrueType font file name.</para>
+
+ <para>This also produces a <filename>.pfa</filename> file, the
+ ascii postscript font metrics file
+ (<filename>.pfb</filename> is for the binrary form). This
+ won't be needed, but could (I think) be useful for a
+ fontserver.</para>
+
+ <para>For example, to convert the 30f9 Barcode font using the
+ default file names, use the following command:</para>
+
+ <screen>
+<prompt>%</prompt> <userinput>gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf</userinput>
+Aladdin Ghostscript 5.10 (1997-11-23)
+Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved.
+This software comes with NO WARRANTY: see the file PUBLIC for details.
+Converting 3of9.ttf to 3of9.pfa and 3of9.afm.
+ </screen>
+
+ <para>If you want the converted fonts to be stored in
+ <filename>A.pfa</filename> and <filename>B.afm</filename>,
+ then use this command:</para>
+
+ <screen>
+<prompt>%</prompt> <userinput>gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf A B</userinput>
+Aladdin Ghostscript 5.10 (1997-11-23)
+Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved.
+This software comes with NO WARRANTY: see the file PUBLIC for details.
+Converting 3of9.ttf to A.pfa and B.afm.
+ </screen>
+ </listitem>
+
+ <listitem>
+ <para>Create the groff postscript file:</para>
+
+ <para>Change directories to
+ <filename>/usr/share/groff_font/devps</filename> so as to
+ make the following command easier to execute. You'll
+ probably need root priviledges for this. (Or, if you're
+ paranoid about working there, make sure you reference the
+ files <filename>DESC</filename>,
+ <filename>text.enc</filename> and
+ <filename>generate/textmap</filename> as being in this
+ directory.)</para>
+
+ <screen>
+<prompt>%</prompt> <userinput>afmtodit -d DESC -e text.enc file.afm \
+ generate/textmap <replaceable>PS_font_name</replaceable></userinput>
+ </screen>
+
+ <para>Where, <filename>file.afm</filename> is the
+ <replaceable>AFM_name</replaceable> created by
+ <command>ttf2pf.ps</command> above, and
+ <replaceable>PS_font_name</replaceable> is the font name
+ used from that command, as well as the name that
+ <citerefentry> <refentrytitle>groff</><manvolnum>1</></>
+ will use for references to this font. For example, assuming
+ you used the first <command>tiff2pf.ps</command> command
+ above, then the 3of9 Barcode font can be created using the
+ command:</para>
+
+ <screen>
+<prompt>%</prompt> <userinput>afmtodit -d DESC -e text.enc 3of9.afm \
+ generate/textmap 3of9</userinput>
+ </screen>
+
+ <para>Ensure that the resulting
+ <replaceable>PS_font_name</replaceable> file (e.g.,
+ <filename>3of9</filename> in the example above) is located
+ in the directory
+ <filename>/usr/share/groff_font/devps</filename> by copying
+ or moving it there.</para>
+
+ <para>Note that if <filename>ttf2pf.ps</filename> assigns a
+ font name using the one it finds in the TrueType font file
+ and you want to use a different name, you must edit the
+ <filename>.afm</filename> file prior to running
+ <command>afmtodit</command>. This name must also match the
+ one used in the Fontmap file if you wish to pipe
+ <citerefentry><refentrytitle>groff</><manvolnum>1</></> into
+ <citerefentry><refentrytitle>gs</><manvolnum>1</></>.</para>
+ </listitem>
+ </orderedlist>
+ </chapter>
+
<chapter>
-<title>Can TrueType fonts be used?</title>
+<title>Can TrueType fonts be used with other programs?</title>
<para>The TrueType font format is used by Windows, Windows 95, and
Mac's. It is quite popular and there are a great number of
@@ -644,12 +835,6 @@ Povray version 3 also has the ability to use TrueType fonts, but
I rather doubt many people will be creating documents as a series of
raytraced pages :-).</para>
-<para>Using TrueType with groff is difficult because groff would
-need a font description file, and I know of no tools to construct
-the metrics from a TrueType font. In addition, the font would have to
-be downloaded to postscript printers in the appropriate format,
-and again, groff cannot handle TrueType fonts in this fashion.</para>
-
<para>This rather dismal situation may soon change.
The <ulink url="http://www.freetype.org/">FreeType Project</ulink>
is currently developing a useful set of FreeType tools: