diff options
author | John Fieber <jfieber@FreeBSD.org> | 1997-02-15 18:02:20 +0000 |
---|---|---|
committer | John Fieber <jfieber@FreeBSD.org> | 1997-02-15 18:02:20 +0000 |
commit | 7752550372fdb5246a49fd25500dc97aba6f9464 (patch) | |
tree | 144bb8da46a54ab2d99663a3770467faa9daf15c /en | |
parent | 57fec94fc183ee6b4961d0e5d2b8b1e22b0e4369 (diff) | |
download | doc-7752550372fdb5246a49fd25500dc97aba6f9464.tar.gz doc-7752550372fdb5246a49fd25500dc97aba6f9464.zip |
Fonts tutorial goes from linuxdoc to docbook.
Notes
Notes:
svn path=/head/; revision=1169
Diffstat (limited to 'en')
-rw-r--r-- | en/tutorials/Makefile | 4 | ||||
-rw-r--r-- | en/tutorials/fonts/Makefile | 7 | ||||
-rw-r--r-- | en/tutorials/fonts/fonts.docb | 723 | ||||
-rw-r--r-- | en/tutorials/fonts/fonts.sgml | 517 | ||||
-rw-r--r-- | en/tutorials/index.sgml | 6 |
5 files changed, 730 insertions, 527 deletions
diff --git a/en/tutorials/Makefile b/en/tutorials/Makefile index 144ddf18d6..145d4a8a68 100644 --- a/en/tutorials/Makefile +++ b/en/tutorials/Makefile @@ -1,5 +1,5 @@ DOCS= index.sgml -SUBDIR= devel disklessx mh newuser -DOCSUBDIR= ddwg fonts multios ppp +SUBDIR= devel disklessx fonts mh newuser +DOCSUBDIR= ddwg multios ppp .include "../web.mk" diff --git a/en/tutorials/fonts/Makefile b/en/tutorials/fonts/Makefile index 4ccd43e7b5..6241e4e513 100644 --- a/en/tutorials/fonts/Makefile +++ b/en/tutorials/fonts/Makefile @@ -1,5 +1,4 @@ -DOC= fonts -SRCS= fonts.sgml - -.include <bsd.sgml.mk> +DOCS= fonts.docb +INDEXLINK= fonts.html +.include "../../web.mk" diff --git a/en/tutorials/fonts/fonts.docb b/en/tutorials/fonts/fonts.docb new file mode 100644 index 0000000000..5948268167 --- /dev/null +++ b/en/tutorials/fonts/fonts.docb @@ -0,0 +1,723 @@ +<!-- $Id: fonts.docb,v 1.1 1997-02-15 18:02:20 jfieber Exp $ --> +<!-- The FreeBSD Documentation Project --> +<!DOCTYPE BOOK PUBLIC "-//Davenport//DTD DocBook V3.0//EN"> + +<!-- Recently, I wanted to figure out how to use some additional fonts that + I had accumulated. I finally figured out *how to do it* from the various + man pages and documentation. Since it might be of use to other users, + and I didn't see any reference to this topic in the FAQ or handbook, I + thought I'd try my hand at a simple cookbook tutorial addressing the + use of fonts. I have included my unanswered questions at the end of + the document. + + Anyway, here's what I put together. This is my present understanding of + fonts and how to use them with FreeBSD. I am sure that there are errors or + misunderstandings, but it contains enough valid information to allow the + use of additional fonts with Ghostscript, X11 and Groff. This is my first + attempt to write anything along the lines of a tutorial/FAQ, so I am sure + it is pretty raw. There are probably better ways to do some of this stuff, + and I would welcome being corrected. + --> + +<book> + +<bookinfo> +<bookbiblio> +<title>Fonts and FreeBSD</title> +<subtitle>A Tutorial</subtitle> + +<authorgroup> +<author> +<firstname>Dave</firstname> +<surname>Bodenstab</surname> +<affiliation> +<address><email>imdave@synet.net</email></address> +</affiliation> +</author> +</authorgroup> + +<pubdate>Wed Aug 7, 1996</pubdate> + +<abstract><para>This document contains a description of the various +font files that may be used with FreeBSD and the syscons driver, X11, +Ghostscript and Groff. Cookbook examples are provided for switching +the syscons display to 80x60 mode, and for using type 1 fonts with +the above application programs.</para></abstract> + +</bookbiblio> +</bookinfo> + +<chapter> +<title>Introduction</title> + +<para>There are many sources of fonts available, and one might ask +how they might be used with FreeBSD. The answer can be found by +carefully searching the documentation for the component that one +would like to use. This is very time consuming, so this tutorial is +an attempt to provide a shortcut for others who might be +interested.</para> + +</chapter> + +<chapter> +<title>Basic terminology</title> + +<para>There are many different font formats and associated font file +suffixes. A few that will be addressed here are: +<variablelist> + +<varlistentry><term><filename>.pfa</>, <filename>.pfb</></term> + +<listitem><para>Postscript type 1 fonts. The <filename>.pfa</filename> is the +<emphasis>A</emphasis>scii form and <filename>.pfb</filename> the +<emphasis>B</emphasis>inary form.</para></listitem> + +</varlistentry> + +<varlistentry><term><filename>.afm</></term> + +<listitem><para>The font metrics associated with a type 1 +font.</para></listitem> + +</varlistentry> + +<varlistentry><term><filename>.pfm</></term> + +<listitem><para>The printer font metrics associated with a type 1 +font.</para></listitem> + +</varlistentry> + +<varlistentry><term><filename>.ttf</></term> + +<listitem><para>A TrueType font</para></listitem> + +</varlistentry> + +<varlistentry><term><filename>.fot</></term> + +<listitem><para>An indirect reference to a TrueType font (not an +actual font)</para></listitem> + +</varlistentry> + +<varlistentry><term><filename>.fon</>, <filename>.fnt</></term> + +<listitem><para>Bitmapped screen fonts</para></listitem> + +</varlistentry> +</variablelist></para> + +<para>The <filename>.fot</filename> file is used by Windows as sort +of a symbolic link to the actual TrueType font +(<filename>.ttf</filename>) file. The <filename>.fon</filename> font +files are also used by Windows. I know of no way to use this font +format with FreeBSD.</para> + +</chapter> + +<chapter> +<title>What font formats can I use?</title> + +<para>Which font file format is useful depends on the application +being used. FreeBSD by itself uses no fonts. Application programs +and/or drivers may make use of the font files. Here is a small cross +reference of application/driver to the font type suffixes:</para> + +<para> +<variablelist> +<varlistentry><term>Driver</term> +<listitem> +<para> +<variablelist> +<varlistentry><term>syscons</term> +<listitem> +<para><filename>.fnt</></para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +</listitem> +</varlistentry> + +<varlistentry><term>Application</term> + +<listitem> +<para> +<variablelist> +<varlistentry><term>Ghostscript</term> +<listitem> +<para><filename>.pfa</filename>, <filename>.pfb</filename>, <filename>.ttf</filename></para> + +</listitem> +</varlistentry> + +<varlistentry><term>X11</term> + +<listitem> +<para><filename>.pfa</filename>, <filename>.pfb</filename></para> + +</listitem> +</varlistentry> + +<varlistentry><term>Groff</term> + +<listitem> +<para><filename>.pfa</filename>, <filename>.afm</filename></para> + +</listitem> +</varlistentry> + +<varlistentry><term>Povray</term> + +<listitem> +<para><filename>.ttf</filename></para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +</listitem> +</varlistentry> +</variablelist> +</para> + +<para>The <filename>.fnt</filename> suffix is used quite frequently. +I suspect that whenever someone wanted to create a specialized font +file for their application, more often than not they chose this +suffix. Therefore, it is likely that files with this suffix are not +all the same format; specifically, the <filename>.fnt</filename> +files used by syscons under FreeBSD may not be the same format as a +<filename>.fnt</filename> file one encounters in the MSDOS/Windows +environment. I have not made any attempt at using other +<filename>.fnt</filename> files other than those provided with +FreeBSD.</para> + +</chapter> + +<chapter> +<title>Setting a virtual console to 80x60 line mode</title> + +<para>First, a 8x8 font must be loaded. +<filename>/etc/sysconfig</filename> should contain the lines: +<informalexample> +<programlisting># Choose font 8x8 from /usr/share/syscons/fonts/* (or NO for default) +font8x8=/usr/share/syscons/fonts/cp437-8x8.fnt</programlisting> +</informalexample> +</para> + +<para>The command to actually switch the mode is +<citerefentry><refentrytitle>vidcontrol</><manvolnum>1</></>: +<informalexample> +<screen>bash$ <userinput>vidcontrol VGA_80x60</userinput></screen> +</informalexample> +</para> + +<para>Various screen orientated programs, such as +<citerefentry><refentrytitle>vi</><manvolnum>1</></>, must be able to +determine the current screen dimensions. These can be set with +<citerefentry><refentrytitle>stty</><manvolnum>1</></>: +<informalexample> +<screen>bash$ <userinput>stty crt rows 60 columns 80</userinput></screen> +</informalexample> +</para> + +<para>To make this more seamless, one can embed these commands in the +startup scripts so it takes place when the system boots. One way to +do this is: +<orderedlist> + +<listitem> +<para>Modify <filename>/etc/sysconfig</filename> as above</para> +</listitem> + +<listitem> +<para>Add to <filename>/etc/rc.local</filename>: +<informalexample> +<programlisting>for tty in /dev/ttyv? +do + vidcontrol VGA_80x60 <$tty >/dev/null 2>&1 +done</programlisting> +</informalexample></para> +</listitem> + +<listitem> +<para>Add to <filename>/etc/profile</filename>: +<informalexample> +<programlisting>TTYNAME=`basename \`tty\`` +if expr "$TTYNAME" : 'ttyv' >/dev/null +then + stty crt rows 60 columns 80 +fi</programlisting> +</informalexample> +</para> +</listitem> + +</orderedlist> +</para> + +<para>References: +<citerefentry><refentrytitle>stty</><manvolnum>1</></>, +<citerefentry><refentrytitle>vidcontrol</><manvolnum>1</></>.</para> + +</chapter> + +<chapter> +<title>Using type 1 fonts with X11</title> + +<para>X11 can use either the <filename>.pfa</filename> or the +<filename>.pfb</filename> format fonts. The X11 fonts are located in +various subdirectories under +<filename>/usr/X11R6/lib/X11/fonts</filename>. Each font file is +cross referenced to its X11 name by the contents of the +<filename>fonts.dir</filename> file in each directory.</para> + +<para>There is already a directory named <filename>Type1</>. The most +straight forward way to add a new font is to put it into this +directory. A better way is to keep all new fonts in a separate +directory and use a symbolic link to the additional font. This +allows one to more easily keep track of ones fonts without confusing +them with the fonts that were originally provided. For +example: +<informalexample> +<screen><lineannotation>Create a directory to contain the font files</> +bash$ <userinput>mkdir -p /usr/local/share/fonts/type1</> +bash$ <userinput>cd /usr/local/share/fonts/type1</> + +<lineannotation>Place the .pfa, .pfb and .afm files here</> +<lineannotation>One might want to keep readme files, and other documentation</> +<lineannotation>for the fonts here also</> +bash$ <userinput>cp /cdrom/fonts/atm/showboat/showboat.pfb .</> +bash$ <userinput>cp /cdrom/fonts/atm/showboat/showboat.afm .</> + +<lineannotation>Maintain an index to cross reference the fonts</> +bash$ <userinput>echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX</></screen> +</informalexample> +</para> + +<para>Now, to use a new font with X11, one must make the font file +available and update the font name files. The X11 font names look +like: +<informalexample> +<screen>-bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 + | | | | | | | | | | | | \ \ + | | | | | \ \ \ \ \ \ \ +----+- character set + | | | | \ \ \ \ \ \ \ +- average width + | | | | \ \ \ \ \ \ +- spacing + | | | \ \ \ \ \ \ +- vertical res. + | | | \ \ \ \ \ +- horizontal res. + | | | \ \ \ \ +- points + | | | \ \ \ +- pixels + | | | \ \ \ + foundry family weight slant width additional style</screen> +</informalexample> +</para> + +<para>A new name needs to be created for each new font. If you have +some information from the documentation that accompanied the font, +then it could serve as the basis for creating the name. If there is +no information, then you can get some idea by using +<citerefentry><refentrytitle>strings</><manvolnum>1</></> on the font +file. For example: +<informalexample> +<screen>bash$ <userinput>strings showboat.pfb | more</> +%!FontType1-1.0: Showboat 001.001 +%%CreationDate: 1/15/91 5:16:03 PM +%%VMusage: 1024 45747 +% Generated by Fontographer 3.1 +% Showboat + 1991 by David Rakowski. Alle Rechte Vorbehalten. +FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup +/UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse +{save true}{false}ifelse}{false}ifelse +12 dict begin +/FontInfo 9 dict dup begin + /version (001.001) readonly def + /FullName (Showboat) readonly def + /FamilyName (Showboat) readonly def + /Weight (Medium) readonly def + /ItalicAngle 0 def + /isFixedPitch false def + /UnderlinePosition -106 def + /UnderlineThickness 16 def + /Notice (Showboat + 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def +end readonly def +/FontName /Showboat def +--stdin--</screen> +</informalexample></para> + +<para>Using this information, a possible name might be: +<informalexample> +<screen>-type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1</screen> +</informalexample> +</para> + +<para>The components of our name are: +<variablelist> + +<varlistentry><term>Foundry</term> +<listitem> +<para>Lets just name all the new fonts <literal>type1</>.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Family</term> +<listitem> +<para>The name of the font.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Weight</term> +<listitem> +<para>Normal, bold, medium, semibold, etc. From the +<citerefentry><refentrytitle>strings</><manvolnum>1</></> output +above, it appears that this font has a weight of +<emphasis>medium</emphasis>.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Slant</term> +<listitem> +<para><emphasis remap=bf>r</emphasis>oman, <emphasis +remap=bf>i</emphasis>talic, <emphasis remap=bf>o</emphasis>blique, +etc. Since the <emphasis>ItalicAngle</emphasis> is zero, +<emphasis>roman</emphasis> will be used.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Width</term> +<listitem> +<para>Normal, wide, condensed, extended, etc. Until it can be examined, +the assumption will be <emphasis>normal</emphasis>.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Additional style</term> +<listitem> +<para>Usually omitted, but this will indicate that +the font contains decorative capital letters.</para> +</listitem> +</varlistentry> + +<varlistentry><term>Spacing</term> +<listitem> +<para>proportional or monospaced. <emphasis>Proportional</emphasis> +is used since <emphasis>isFixedPitch</emphasis> is false.</para> +</listitem> +</varlistentry> + +</variablelist> +</para> + +<para>All of these names are arbitrary, but one should strive to be +compatible with the existing conventions. A font is referenced by +name with possible wild cards by an X11 program, so the name chosen +should make some sense. One might begin by simply using +<informalexample> +<screen>…-normal-r-normal-…-p-…</screen> +</informalexample> +as the name, and then use +<citerefentry><refentrytitle>xfontsel</><manvolnum>1</></> to examine it +and adjust the name based on the appearance of the font.</para> + +<para>So, to complete our example: +<informalexample> +<screen><lineannotation>Make the font accessible to X11</> +bash$ <userinput>cd /usr/X11R6/lib/X11/fonts/Type1</> +bash$ <userinput>ln -s /usr/local/share/fonts/type1/showboat.pfb .</> + +<lineannotation>Edit fonts.dir and fonts.scale, adding the line describing the font +and incrementing the number of fonts which is found on the first line.</> +bash$ <userinput>ex fonts.dir +:1p +25 +:1c +26 +. +:$a +showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 +. +:wq</> + +<lineannotation><filename>fonts.scale</> seems to be identical to <filename>fonts.dir</>…</> +bash$ <userinput>cp fonts.dir fonts.scale</> + +<lineannotation>Tell X11 that things have changed</> +bash$ <userinput>xset fp rehash</> + +<lineannotation>Examine the new font</> +bash$ <userinput>xfontsel -pattern -type1-*</></screen> +</informalexample> +</para> + +<para>References: +<citerefentry><refentrytitle>xfontsel</><manvolnum>1</></>, +<citerefentry><refentrytitle>xset</><manvolnum>1</></>, +<citetitle>The X Windows System in a Nutshell</>, <ulink +URL="http://www.ora.com/">O'Reilly & Associates</ulink>.</para> + +</chapter> + +<chapter> +<title>Using type 1 fonts with Ghostscript</title> + +<para>Ghostscript references a font via its <filename>Fontmap</> +file. This must be modified in a similar way to the X11 +<filename>fonts.dir</filename> file. Ghostscript can use either the +<filename>.pfa</filename> or the <filename>.pfb</filename> format +fonts. Using the font from the previous example, here is how to use +it with Ghostscript: +<informalexample> +<screen><lineannotation>Put the font in Ghostscript's font directory</> +bash$ <userinput>cd /usr/local/share/ghostscript/fonts</> +bash$ <userinput>ln -s /usr/local/share/fonts/type1/showboat.pfb .</> + +<lineannotation>Edit Fontmap so Ghostscript knows about the font</> +bash$ <userinput>cd /usr/local/share/ghostscript/4.01</> +bash$ <userinput>ex Fontmap +:$a +/Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat +. +:wq</> + +<lineannotation>Use Ghostscript to examine the font</> +bash$ <userinput>gs prfont.ps</> +Aladdin Ghostscript 4.01 (1996-7-10) +Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights +reserved. +This software comes with NO WARRANTY: see the file PUBLIC for details. +Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... + /1899520 581354 1300084 13826 0 done. +GS><userinput>Showboat DoFont</> +Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... + 1939688 565415 1300084 16901 0 done. +>>showpage, press <return> to continue<< +>>showpage, press <return> to continue<< +>>showpage, press <return> to continue<< +GS><userinput>quit</></screen> +</informalexample> +</para> + +<para>References: <filename>fonts.txt</filename> in the Ghostscript +4.01 distribution</para> + +</chapter> + +<chapter> +<title>Using type 1 fonts with Groff</title> + +<para>Now that the new font can be used by both X11 and Ghostscript, +how can one use the new font with groff? First of all, since we are +dealing with type 1 postscript fonts, the groff device that is +applicable is the <emphasis>ps</emphasis> device. A font file must be +created for each font that groff can use. A groff font name is just +a file in <filename>/usr/share/groff_font/devps</filename>. With our +example, the font file could be +<filename>/usr/share/groff_font/devps/SHOWBOAT</filename>. The file +must be created using tools provided by groff.</para> + +<para>The first tool is <command>afmtodit</>. This is not normally +installed, so it must be retrieved from the source distribution. I +found I had to change the first line of the file, so I did: +<informalexample> +<screen>bash$ <userinput>cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp</> +bash$ <userinput>ex /tmp/afmtodit.pl +:1c +#!/usr/bin/perl -P- +. +:wq</></screen> +</informalexample> +</para> + +<para>This tool will create the groff font file from the metrics file +(<filename>.afm</filename> suffix.) Continuing with our +example: +<informalexample> +<screen><lineannotation>Many <filename>.afm</> files are in Mac format&hellip ^M delimited lines +We need to convert them to unix style ^J delimited lines</> +bash$ <userinput>cd /tmp</> +bash$ <userinput>cat /usr/local/share/fonts/type1/showboat.afm | + tr '\015' '\012' >showboat.afm</> + +<lineannotation>Now create the groff font file</> +bash$ <userinput>cd /usr/share/groff_font/devps</> +bash$ <userinput>/tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT</></screen> +</informalexample> +</para> + +<para>The font can now be referenced with the name SHOWBOAT.</para> + +<para>If ghostscript is used to drive the printers on the system, +then nothing more needs to be done. However, if true postscript +printers are used, then the font must be down loaded to the printer +in order for the font to be used (unless the printer happens to have +the showboat font built in or on an accessible font disk.) The final +step is to create a down loadable font. The <command>pfbtops</> tool +is used to create the <filename>.pfa</filename> format of the font, +and the <filename>download</> file is modified to reference the new +font. The <filename>download</> file must reference the internal +name of the font. This can easily be determined from the groff font +file as illustrated: +<informalexample> +<screen><lineannotation>Create the <filename>.pfa</> font file</> +bash$ <userinput>pfbtops /usr/local/share/fonts/type1/showboat.pfb >showboat.pfa</></screen> +</informalexample> +Of course, if the <filename>.pfa</filename> file is already +available, just use a symbolic link to reference it. +<informalexample> +<screen><lineannotation>Get the internal font name</> +bash$ <userinput>fgrep internalname SHOWBOAT</> +internalname Showboat + +<lineannotation>Tell groff that the font must be down loaded</> +bash$ <userinput>ex download +:$a +Showboat showboat.pfa +. +:wq</></screen> +</informalexample> +</para> + +<para>To test the font: +<informalexample> +<screen>bash$ <userinput>cd /tmp</> +bash$ <userinput>cat >example.t <<EOF +.sp 5 +.ps 16 +This is an example of the Showboat font: +.br +.ps 48 +.vs (\n(.s+2)p +.sp +.ft SHOWBOAT +ABCDEFGHI +.br +JKLMNOPQR +.br +STUVWXYZ +.sp +.ps 16 +.vs (\n(.s+2)p +.fp 5 SHOWBOAT +.ft R +To use it for the first letter of a paragraph, it will look like: +.sp 50p +\s(48\f5H\s0\fRere is the first sentence of a paragraph that uses the +showboat font as its first letter. +Additional vertical space must be used to allow room for the larger +letter. +EOF</> +bash$ <userinput>groff -Tps example.t >example.ps</> + +<lineannotation>To use ghostscript/ghostview</> +bash$ <userinput>ghostview example.ps</> + +<lineannotation>To print it</> +bash$ <userinput>lpr -Ppostscript example.ps</></screen> +</informalexample> +</para> + +<para>References: +<filename>/usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man</filename>, +<citerefentry><refentrytitle>groff_font</><manvolnum>5</></>, +<citerefentry><refentrytitle>groff_char</><manvolnum>5</></>, +<citerefentry><refentrytitle>pfbtops</><manvolnum>1</></>.</para> + +</chapter> + +<chapter> +<title>Can TrueType fonts be used?</title> + +<para>The TrueType font format is used by Windows, Windows 95, +Mac's,&hellip It is quite popular and there are a great number of +fonts available in this format. Unfortunately, there are only two +applications that I am aware of that can use this format: Ghostscript +and povray. Ghostscript's support, according to the documentation, +is rudimentary and the results are likely to be inferior to type 1 +fonts.</para> + +<para>However, 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 down loaded to postscript +printers in the appropriate format, and again, groff cannot handle +TrueType fonts in this fashion.</para> + +<para>X11 has no support for TrueType fonts that I am aware +of.</para> + +<para>The only program that I know of that has the ability to use +TrueType fonts is povray version 3, but I rather doubt many people +will be creating documents as a series of raytraced pages! +:-)</para> + +</chapter> + +<chapter> +<title>Where can additional fonts be obtained?</title> + +<para>Many fonts are available on the Internet. They are either +entirely free, or are share-ware. In addition, there are many +inexpensive CDROMs available that contain many fonts. Some Internet +locations (as of August 1996) are: +<itemizedlist> + +<listitem><para><ulink +url="ftp://ftp.winsite.com">ftp://ftp.winsite.com</ulink> (Formerly +CICA)</para></listitem> + +<listitem><para><ulink +url="http://www.simtel.net/simcgi-bin/dosfind.cgi">http://www.simtel.net/simcgi-bin/dosfind.cgi</ulink></para></listitem> + +<listitem><para><ulink +url="ftp://ftp.coast.net/">ftp://ftp.coast.net/</ulink></para></listitem> + +<listitem><para><ulink +url="http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html">http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html</ulink></para></listitem> + +<listitem><para><ulink +url="http://www.esselte.com/letraset/index.html">http://www.esselte.com/letraset/index.html</ulink></para></listitem> + +<listitem><para><ulink +url="http://www.inil.com/users/elfring/esf.htm">http://www.inil.com/users/elfring/esf.htm</ulink></para></listitem> + +</itemizedlist></para> + +</chapter> + +<chapter> +<title>Additional questions</title> + +<para> +<itemizedlist> + +<listitem> +<para>What use are the <filename>.pfm</filename> files?</para> +</listitem> + +<listitem> +<para>Can one generate the <filename>.afm</filename> file from a <filename>.pfa</filename> or <filename>.pfb</filename>?</para> +</listitem> + +<listitem> +<para>How to generate the groff character mapping files for postscript fonts +with non-standard character names?</para> +</listitem> + +<listitem> +<para>Can xditview and devX?? devices be setup to access all the new fonts?</para> +</listitem> + +<listitem> +<para>It would be good to have examples of using TrueType fonts with povray and +ghostscript.</para> +</listitem> + +</itemizedlist> +</para> + +</chapter> +</book> diff --git a/en/tutorials/fonts/fonts.sgml b/en/tutorials/fonts/fonts.sgml deleted file mode 100644 index db168c6bd4..0000000000 --- a/en/tutorials/fonts/fonts.sgml +++ /dev/null @@ -1,517 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN"> - -<!-- Recently, I wanted to figure out how to use some additional fonts that - I had accumulated. I finally figured out *how to do it* from the various - man pages and documentation. Since it might be of use to other users, - and I didn't see any reference to this topic in the FAQ or handbook, I - thought I'd try my hand at a simple cookbook tutorial addressing the - use of fonts. I have included my unanswered questions at the end of - the document. - - Anyway, here's what I put together. This is my present understanding of - fonts and how to use them with FreeBSD. I am sure that there are errors or - misunderstandings, but it contains enough valid information to allow the - use of additional fonts with Ghostscript, X11 and Groff. This is my first - attempt to write anything along the lines of a tutorial/FAQ, so I am sure - it is pretty raw. There are probably better ways to do some of this stuff, - and I would welcome being corrected. - --> - -<article> - -<title>Fonts and FreeBSD — A Tutorial -<author>Dave Bodenstab, <imdave@synet.net> -<date>Wed Aug 7, 1996 -<abstract> -This document contains a description of the various font files that may -be used with FreeBSD and the syscons driver, X11, Ghostscript and Groff. -Cookbook examples are provided for switching the syscons display to -80x60 mode, and for using type 1 fonts with the above application programs. -</abstract> - -<sect>Introduction - -<p> -There are many sources of fonts available, and one might ask how they might -be used with FreeBSD. -The answer can be found by carefully searching the documentation for the -component that one would like to use. -This is very time consuming, so this tutorial is an attempt to provide a shortcut -for others who might be interested. - -<sect>Basic terminology - -<p> -There are many different font formats and associated font file suffixes. -A few that will be addressed here are: - -<descrip> - -<tag/.pfa .pfb/ Postscript type 1 fonts. The <em/.pfa/ is the <bf/A/scii form -and <em/.pfb/ the <bf/B/inary form. -<tag/.afm/ The font metrics associated with a type 1 font. -<tag/.pfm/ The printer font metrics associated with a type 1 font. -<tag/.ttf/ A TrueType font -<tag/.fot/ An indirect reference to a TrueType font (not an actual font) -<tag/.fon .fnt/ Bitmapped screen fonts - -</descrip> - -<p> -The <em/.fot/ file is used by Windows as sort of a symbolic link to the actual -TrueType font (<em/.ttf/) file. The <em/.fon/ font files are also used by Windows. -I know of no way to use this font format with FreeBSD. - -<sect>What font formats can I use? - -<p> -Which font file format is useful depends on the application being used. -FreeBSD by itself uses no fonts. Application programs and/or drivers may -make use of the font files. Here is a small cross reference of -application/driver to the font type suffixes: - -<descrip> -<tag/Driver/ -<descrip> -<tag/syscons/ .fnt -</descrip> - -<tag/Application/ -<descrip> -<tag/Ghostscript/ <em/.pfa/ <em/.pfb/ <em/.ttf/ -<tag/X11/ <em/.pfa/ <em/.pfb/ -<tag/Groff/ <em/.pfa/ <em/.afm/ -<tag/Povray/ <em/.ttf/ -</descrip> -</descrip> - -<p> -The <em/.fnt/ suffix is used quite frequently. I suspect that whenever someone -wanted to create a specialized font file for their application, more often -than not they chose this suffix. Therefore, it is likely that files with -this suffix are not all the same format; specifically, the <em/.fnt/ files used -by syscons under FreeBSD may not be the same format as a <em/.fnt/ file one -encounters in the MSDOS/Windows environment. I have not made any attempt -at using other <em/.fnt/ files other than those provided with FreeBSD. - -<sect>Setting a virtual console to 80x60 line mode - -<p> -First, a 8x8 font must be loaded. <tt>/etc/sysconfig</tt> should contain the lines: -<tscreen><verb> -# Choose font 8x8 from /usr/share/syscons/fonts/* (or NO for default) -font8x8=/usr/share/syscons/fonts/cp437-8x8.fnt -</verb></tscreen> - -<p> -The command to actually switch the mode is <em/vidcontrol/(1): - -<tscreen><verb> -bash$ vidcontrol VGA_80x60 -</verb></tscreen> - -<p> -Various screen orientated programs, such as <em/vi/(1), must be able to determine -the current screen dimensions. These can be set with <em/stty/(1): - -<tscreen><verb> -bash$ stty crt rows 60 columns 80 -</verb></tscreen> - -<p> -To make this more seamless, one can embed these commands in the startup -scripts so it takes place when the system boots. One way to do this is: - -<enum> -<item> Modify <tt>/etc/sysconfig</tt> as above -<item> Add to <tt>/etc/rc.local</tt>: - -<tscreen><verb> -for tty in /dev/ttyv? -do - vidcontrol VGA_80x60 <$tty >/dev/null 2>&1 -done -</verb></tscreen> - -<item> Add to <tt>/etc/profile</tt>: - -<tscreen><verb> -TTYNAME=`basename \`tty\`` -if expr "$TTYNAME" : 'ttyv' >/dev/null -then - stty crt rows 60 columns 80 -fi -</verb></tscreen> -</enum> - -<p> -References: <em/stty/(1), <em/vidcontrol/(1) - -<sect>Using type 1 fonts with X11 - -<p> -X11 can use either the <em/.pfa/ or the <em/.pfb/ format fonts. The X11 fonts are -located in various subdirectories under <tt>/usr/X11R6/lib/X11/fonts</tt>. Each -font file is cross referenced to -its X11 name by the contents of the <tt/fonts.dir/ file in each directory. -<p> -There is already a directory named <tt/Type1/. -The most straight forward way to add a -new font is to put it into this directory. A better way is to keep all new -fonts in a separate directory and use a symbolic link to the additional -font. This allows one to more easily keep track of ones fonts without -confusing them with the fonts that were originally provided. For example: - -<tscreen><verb> -# Create a directory to contain the font files -bash$ mkdir -p /usr/local/share/fonts/type1 -bash$ cd /usr/local/share/fonts/type1 - -# Place the .pfa, .pfb and .afm files here -# One might want to keep readme files, and other documentation -# for the fonts here also -bash$ cp /cdrom/fonts/atm/showboat/showboat.pfb . -bash$ cp /cdrom/fonts/atm/showboat/showboat.afm . - -# Maintain an index to cross reference the fonts -bash$ echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX -</verb></tscreen> - -<p> -Now, to use a new font with X11, one must make the font file available and -update the font name files. The X11 font names look like: - -<tscreen><verb> - -bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 - | | | | | | | | | | | | \ \ - | | | | | \ \ \ \ \ \ \ +----+- character set - | | | | \ \ \ \ \ \ \ +- average width - | | | | \ \ \ \ \ \ +- spacing - | | | \ \ \ \ \ \ +- vertical res. - | | | \ \ \ \ \ +- horizontal res. - | | | \ \ \ \ +- points - | | | \ \ \ +- pixels - | | | \ \ \ - foundry family weight slant width additional style -</verb></tscreen> - -<p> -A new name needs to be created for each new font. If you have some information -from the documentation that accompanied the font, then it could serve as the basis -for creating the name. If there is no information, then you can get some idea -by using <em/strings/(1) on the font file. For example: - -<tscreen><verb> -bash$ strings showboat.pfb | more -%!FontType1-1.0: Showboat 001.001 -%%CreationDate: 1/15/91 5:16:03 PM -%%VMusage: 1024 45747 -% Generated by Fontographer 3.1 -% Showboat - 1991 by David Rakowski. Alle Rechte Vorbehalten. -FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup -/UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse -{save true}{false}ifelse}{false}ifelse -12 dict begin -/FontInfo 9 dict dup begin - /version (001.001) readonly def - /FullName (Showboat) readonly def - /FamilyName (Showboat) readonly def - /Weight (Medium) readonly def - /ItalicAngle 0 def - /isFixedPitch false def - /UnderlinePosition -106 def - /UnderlineThickness 16 def - /Notice (Showboat - 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def -end readonly def -/FontName /Showboat def ---stdin-- -</verb></tscreen> - -<p> -Using this information, a possible name might be: - -<tscreen><verb> --type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 -</verb></tscreen> - -The components of our name are: -<itemize> -<item>Foundry — lets just name all the new fonts <tt/type1/. -<item>Family — the name of the font. -<item>Weight — normal, bold, medium, semibold, etc. From the <em/strings/(1) output -above, it appears that this font has a weight of <em/medium/. -<item>Slant — <bf/r/oman, <bf/i/talic, <bf/o/blique, etc. Since the <em/ItalicAngle/ -is zero, <em/roman/ will be used. -<item>Width — normal, wide, condensed, extended, etc. Until it can be examined, -the assumption will be <em/normal/. -<item>Additional style — usually omitted, but this will indicate that -the font contains decorative capital letters. -<item>Spacing — proportional or monospaced. <em/Proportional/ is used since <em/isFixedPitch/ is false. -</itemize> - -<p> -All of these names are arbitrary, but one should strive to be compatible -with the existing conventions. A font is referenced by name with possible -wild cards by an X11 program, so the name chosen should make some sense. -One might begin by simply using -<descrip> -<tt/...-normal-r-normal-...-p-.../ -</descrip> -as the name, -and then use <em/xfontsel/(1) to examine it and adjust the name based on -the appearance of the font. - -<p> -So, to complete our example: - -<tscreen><verb> -# Make the font accessible to X11 -bash$ cd /usr/X11R6/lib/X11/fonts/Type1 -bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . - -# Edit fonts.dir and fonts.scale, adding the line describing the font -# and incrementing the number of fonts which is found on the first line. -bash$ ex fonts.dir -:1p -25 -:1c -26 -. -:$a -showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 -. -:wq - -# fonts.scale seems to be identical to fonts.dir... -bash$ cp fonts.dir fonts.scale - -# Tell X11 that things have changed -bash$ xset fp rehash - -# Examine the new font -bash$ xfontsel -pattern -type1-* -</verb></tscreen> - -<p> -References: <em/xfontsel/(1), <em/xset/(1), <em/The X Windows System in a Nutshell/, -O'Reilly & Associates - -<sect>Using type 1 fonts with Ghostscript - -<p> -Ghostscript references a font via its <tt/Fontmap/ file. This must be modified -in a similar way to the X11 <tt/fonts.dir/ file. Ghostscript can use either the -<em/.pfa/ or the <em/.pfb/ format fonts. Using the font from the previous example, -here is how to use it with Ghostscript: - -<tscreen><verb> -# Put the font in Ghostscript's font directory -bash$ cd /usr/local/share/ghostscript/fonts -bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . - -# Edit Fontmap so Ghostscript knows about the font -bash$ cd /usr/local/share/ghostscript/4.01 -bash$ ex Fontmap -:$a -/Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat -. -:wq - -# Use Ghostscript to examine the font -bash$ gs prfont.ps -Aladdin Ghostscript 4.01 (1996-7-10) -Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights -reserved. -This software comes with NO WARRANTY: see the file PUBLIC for details. -Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... - /1899520 581354 1300084 13826 0 done. -GS>Showboat DoFont -Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... - 1939688 565415 1300084 16901 0 done. ->>showpage, press <return> to continue<< ->>showpage, press <return> to continue<< ->>showpage, press <return> to continue<< -GS>quit -</verb></tscreen> - -<p> -References: <tt/fonts.txt/ in the Ghostscript 4.01 distribution - -<sect>Using type 1 fonts with Groff - -<p> -Now that the new font can be used by both X11 and Ghostscript, how can one -use the new font with groff? First of all, since we are dealing with type 1 -postscript fonts, the groff device that is applicable is the <em/ps/ device. -A font file must be created for each font that groff can use. A groff font -name is just a file in <tt>/usr/share/groff_font/devps</tt>. With our example, the -font file could be <tt>/usr/share/groff_font/devps/SHOWBOAT</tt>. The file must be -created using tools provided by groff. - -<p> -The first tool is <em/afmtodit/. This is not normally installed, so it must be -retrieved from the source distribution. I found I had to change the first -line of the file, so I did: - -<tscreen><verb> -bash$ cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp -bash$ ex /tmp/afmtodit.pl -:1c -#!/usr/bin/perl -P- -. -:wq -</verb></tscreen> - -<p> -This tool will create the groff font file from the metrics file (<em/.afm/ suffix.) -Continuing with our example: - -<tscreen><verb> -# Many .afm files are in Mac format... ^M delimited lines -# We need to convert them to unix style ^J delimited lines -bash$ cd /tmp -bash$ cat /usr/local/share/fonts/type1/showboat.afm | - tr '\015' '\012' >showboat.afm - -# Now create the groff font file -bash$ cd /usr/share/groff_font/devps -bash$ /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT -</verb></tscreen> - -<p> -The font can now be referenced with the name SHOWBOAT. - -<p> -If ghostscript is used to drive the printers on the system, then nothing -more needs to be done. However, if true postscript printers are used, then -the font must be down loaded to the printer in order for the font to be used -(unless the printer happens to have the showboat font built in or on an -accessible font disk.) The final step is to create a down loadable font. -The <em/pfbtops/ tool is used to create the <em/.pfa/ format of the font, and the -<tt/download/ file is modified to reference the new font. The <tt/download/ file -must reference the internal name of the font. This can easily be determined -from the groff font file as illustrated: - -<tscreen><verb> -# Create the .pfa font file -bash$ pfbtops /usr/local/share/fonts/type1/showboat.pfb >showboat.pfa -</verb></tscreen> - -<p> -Of course, if the <em/.pfa/ file is already available, just use a symbolic link -to reference it. - -<tscreen><verb> -# Get the internal font name -bash$ fgrep internalname SHOWBOAT -internalname Showboat - -# Tell groff that the font must be down loaded -bash$ ex download -:$a -Showboat showboat.pfa -. -:wq -</verb></tscreen> - -<p> -To test the font: - -<tscreen><verb> -bash$ cd /tmp -bash$ cat >example.t <<EOF -.sp 5 -.ps 16 -This is an example of the Showboat font: -.br -.ps 48 -.vs (\n(.s+2)p -.sp -.ft SHOWBOAT -ABCDEFGHI -.br -JKLMNOPQR -.br -STUVWXYZ -.sp -.ps 16 -.vs (\n(.s+2)p -.fp 5 SHOWBOAT -.ft R -To use it for the first letter of a paragraph, it will look like: -.sp 50p -\s(48\f5H\s0\fRere is the first sentence of a paragraph that uses the -showboat font as its first letter. -Additional vertical space must be used to allow room for the larger -letter. -EOF -bash$ groff -Tps example.t >example.ps - -# To use ghostscript/ghostview -bash$ ghostview example.ps - -# To print it -bash$ lpr -Ppostscript example.ps -</verb></tscreen> - -<p> -References: <tt>/usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man</tt>, <em/groff_font/(1), -<em/groff_char/(1), <em/pfbtops/(1) - -<sect>Can TrueType fonts be used? - -<p> -The TrueType font format is used by Windows, Windows 95, Mac's,... It is -quite popular and there are a great number of fonts available in this format. -Unfortunately, there are only two applications that I am aware of that can -use this format: Ghostscript and povray. Ghostscript's support, according -to the documentation, is rudimentary and the results are likely to be inferior -to type 1 fonts. - -<p> -However, 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 down loaded to postscript printers in the appropriate format, -and again, groff cannot handle TrueType fonts in this fashion. - -<p> -X11 has no support for TrueType fonts that I am aware of. - -<p> -The only program that I know of that has the ability to use TrueType fonts -is povray version 3, but I rather doubt many people will be creating documents -as a series of raytraced pages! :-) - -<sect>Where can additional fonts be obtained? - -<p> -Many fonts are available on the Internet. They are either entirely -free, or are share-ware. In addition, there are many inexpensive CDROMs -available that contain many fonts. Some Internet locations (as of August -1996) are: - -<tscreen><verb> -ftp://ftp.winsite.com (Formerly CICA) -http://www.simtel.net/simcgi-bin/dosfind.cgi -ftp://ftp.coast.net/ -http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html -http://www.esselte.com/letraset/index.html -http://www.inil.com/users/elfring/esf.htm -</verb></tscreen> - -<sect>Additional questions - -<p> -<itemize> -<item>What use are the <em/.pfm/ files? -<item>Can one generate the <em/.afm/ file from a <em/.pfa/ or <em/.pfb/? -<item>How to generate the groff character mapping files for postscript fonts -with non-standard character names? -<item>Can xditview and devX?? devices be setup to access all the new fonts? -<item>It would be good to have examples of using TrueType fonts with povray and -ghostscript. -</itemize> - -</article> diff --git a/en/tutorials/index.sgml b/en/tutorials/index.sgml index fb075548f2..328d8f052e 100644 --- a/en/tutorials/index.sgml +++ b/en/tutorials/index.sgml @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN" [ <!ENTITY base CDATA ".."> -<!ENTITY date "$Date: 1997-01-19 21:30:13 $"> +<!ENTITY date "$Date: 1997-02-15 18:02:04 $"> <!ENTITY title "FreeBSD Tutorials"> <!ENTITY % includes SYSTEM "../includes.sgml"> %includes; ]> @@ -33,9 +33,7 @@ (<a href="multios/multios.ps">postscript</a>, <a href="multios/multios-html.tar.gz">gzipd tar file</a>)</li> - <li><a href="fonts/fonts.html">Fonts and FreeBSD</a> - (<a href="fonts/fonts.ps">postscript</a>, - <a href="fonts/fonts-html.tar.gz">gzipd tar file</a>)</li> + <li><a href="fonts/fonts.html">Fonts and FreeBSD</a></li> <li><a href="http://lightstorm.gage.com/~black/ipalias.html">IP Aliasing</a></li> </ul> |