📄 ch25.htm
字号:
<TD ALIGN="LEFT"><TT>LogExternalFonts</TT></TD>
<TD ALIGN="LEFT"><TT>false</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>externalFontTolerance</TT></TD>
<TD ALIGN="LEFT"><TT>ExternalFontTolerance</TT></TD>
<TD ALIGN="LEFT"><TT>10.0</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>palette</TT></TD>
<TD ALIGN="LEFT"><TT>Palette</TT></TD>
<TD ALIGN="LEFT"><TT>Color</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>maxGrayRamp</TT></TD>
<TD ALIGN="LEFT"><TT>MaxGrayRamp</TT></TD>
<TD ALIGN="LEFT"><TT>128</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>maxRGBRamp</TT></TD>
<TD ALIGN="LEFT"><TT>MaxRGBRamp</TT></TD>
<TD ALIGN="LEFT"><TT>5</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>useBackingPixmap</TT></TD>
<TD ALIGN="LEFT"><TT>UseBackingPixmap</TT></TD>
<TD ALIGN="LEFT"><TT>true</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>useXPutImage</TT></TD>
<TD ALIGN="LEFT"><TT>UseXPutImage</TT></TD>
<TD ALIGN="LEFT"><TT>true</TT></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>useXSetTile</TT></TD>
<TD ALIGN="LEFT"><TT>UseXSetTile</TT></TD>
<TD ALIGN="LEFT"><TT>true</TT></TD>
</TR>
</TABLE>
</P>
</CENTER>
<P>Here are a few points on these resources:
<UL>
<LI>The geometry resource affects only window placement. It does not affect the position
of the image on the display in the window.
<P>
<LI>All resolution numbers are given in pixels per inch.
<P>
<LI>The <TT>maxRGBRamp</TT> and <TT>maxGrayRamp</TT> control the maximum number of
colors that Ghostscript allocates ahead of time for dithering.
</UL>
<CENTER>
<H3><A NAME="Heading20<FONT COLOR="#000077">Command-Line Arguments</FONT></H3>
</CENTER>
<P>Ghostscript takes a lot of command-line arguments. Generally, you would want to
put these in a shell script file instead of having to type them all the time. Some
of the most often-used arguments are listed here. For a comprehensive list, check
out the documents in <TT>/usr/lib/ghostscript/doc</TT>. Let's look at the most commonly
used arguments:
<UL>
<LI><TT>@list</TT> Lists all the input filenames. This beats typing long names on
every execution of <TT>gs</TT> with lots of input files.
<P>
<LI><TT>-Idirectories</TT> Adds the list of directories at the head of the library
files' search path.
<P>
<LI><TT>-q</TT> Suppresses normal startup messages.
<P>
<LI><TT>-</TT> Uses standard input rather than a file.
<P>
<LI><TT>-dNOPAUSE</TT> Disables the prompt and pause at the end of each page.
</UL>
<P>Remember that almost all of these resources can be set with an equivalent command-line
argument. For example, using the <TT>-title</TT> argument is the same as setting
<TT>Ghostview.showTitle</TT> resource to <TT>True</TT>, whereas using the <TT>-notitle</TT>
argument is the same as setting the <TT>Title</TT> resource to <TT>False</TT>. Similarly,
you can turn the date on or off with the <TT>-date</TT> and <TT>-nodate</TT> arguments.
<CENTER>
<H3><A NAME="Heading21<FONT COLOR="#000077">Using Other Fonts</FONT></H3>
</CENTER>
<P>The versions of Ghostscript come with a set of default fonts you can use with
any program capable of reading PostScript Type 1 and Type 3 fonts. If you have created
your own Type 1 or Type 3 fonts, or have purchased some fonts from another source,
you can use these with Ghostscript. Place your fonts in the <TT>lib/ghostscript/fonts</TT>
directory. Then edit the <TT>lib/ghostscript/FontMap</TT> file to add a line telling
Ghostscript where to find the font. For example:</P>
<PRE><FONT COLOR="#0066FF">/Helvetica (hlv_xyz.pfb);
</FONT></PRE>
<P>In this example, <TT>hlv_xyz.pfb</TT> is the name of the font file you've just
added. You do not have to reset any X resources for this to work. Simply place the
file in the directory, edit the FontMap, and restart gs.
<CENTER>
<H3><A NAME="Heading22<FONT COLOR="#000077">Getting More Help</FONT></H3>
</CENTER>
<P>The gs interpreter recognizes several arguments. You can get help regarding these
options either by reading the man pages or from within gs. Either the <TT>-h</TT>
or the <TT>-?</TT> option tells gs to print a help screen. The help screen also lists
all the available devices for gs on your system.</P>
<P>Ghostscript newsgroups abound. Search for ghostscript or gs in a list of newsgroup
names. Several files can be found in the <TT>/usr/lib/ghostscript/docs</TT> directory
that can provide more information. Here are some of these files:
<UL>
<LI><TT>readme.doc</TT> Information about problems, major changes, and new features
in the current release.
<P>
<LI><TT>NEWS</TT> A detailed history of changes in the most recent Ghostscript releases.
<P>
<LI><TT>use.doc</TT> Information about how to install and use Ghostscript.
<P>
<LI><TT>devices.doc</TT> Detailed information about specific devices that Ghostscript
supports.
<P>
<LI><TT>unix-lpr.doc</TT> More detailed information about some of the shell scripts
and batch files distributed with Ghostscript.
<P>
<LI><TT>make.doc</TT> How to install, compile, and link Ghostscript.
<P>
<LI><TT>gs.1</TT> The man page for Ghostscript.
<P>
<LI><TT>fonts.doc</TT> Information about the fonts distributed with Ghostscript,
including how to add or replace fonts.
<P>
<LI><TT>language.doc</TT> A description of the Ghostscript language and its differences
from the documented PostScript language.
<P>
<LI><TT>psfiles.doc</TT> Information about the <TT>.ps</TT> files distributed with
Ghostscript other than fonts.
<P>
<LI><TT>drivers.doc</TT> Information about the interface between Ghostscript and
device drivers.
<P>
<LI><TT>ps2epsi.doc</TT> Documentation for the PostScript-to-EPSI conversion utility.
Most commercial word processing packages can import EPSI documents for typesetting.
<P>
<LI><TT>hershey.doc</TT> Information about the Hershey fonts, which are the basis
of some Ghostscript fonts.
<P>
<LI><TT>history.doc</TT> A history of changes in older Ghostscript releases.
<P>
<LI><TT>lib.doc</TT> Information about the Ghostscript library.
</UL>
<CENTER>
<H3><A NAME="Heading23<FONT COLOR="#000077">Comments on Output</FONT></H3>
</CENTER>
<P>You can generate PostScript output from various sources. A common output would
be generated from the pbm utilities (see Chapter 69, "Graphics Tools in Linux").
For example, to generate the PostScript output from the contents of a text file using
the pnmtops program, you can use the following command:</P>
<PRE><FONT COLOR="#0066FF">$ pbmtext < textfile.txt | pnmtops | ghostview -
</FONT></PRE>
<P>Do not use this command:</P>
<PRE><FONT COLOR="#0066FF">$ pbmtext < textfile.txt | pnmtops | gs -
</FONT></PRE>
<P>The gs program immediately terminates itself when it sees the end-of-file from
the text file. The ghostview program handles pages better and lets you zoom and scale
the image. It's really quite helpful to look at what the output will look like on
a black-and-white printer.</P>
<P>You can generate raw pbm files for use with the <TT>PBM</TT> file directly. Use
the following constants for each type of <TT>PBM</TT> file:
<UL>
<LI><TT>-sDEVICE=pbm</TT>
<P>
<LI><TT>-sDEVICE=pbmraw</TT>
<P>
<LI><TT>-sDEVICE=pgm</TT>
<P>
<LI><TT>-sDEVICE=pgmraw</TT>
<P>
<LI><TT>-sDEVICE=pnm</TT>
<P>
<LI><TT>-sDEVICE=pnmraw</TT>
</UL>
<P>You can even generate bitmaps for use with Windows with <TT>-sDEVICE=bmp</TT>
options. Various types of bitmaps are supported: 1, 16, or 256 bit.</P>
<P>Also, the gs program can be used to generate Group 3 FAX files for output with
FAX cards. (The G3 generator with the PBM utilities does not work correctly.) Use
the <TT>-sDEVICE=dfaxhigh</TT> and <TT>-sDEVICE=dfaxlow</TT> device names to generate
these outputs and pump them into your FAX modem. I prefer to use sendfax directly
(see Chapter 64), but this is essentially how sendfax works. A modified version of
facsimile format is an enhanced <TT>TIFF</TT> file, for which you can use the <TT>-sDEVICE=tiffg3</TT>
file.</P>
<P>You can write your own programs to generate output for displaying PostScript directly.
My ps3d program reads its input from a text file and generates a 3D perspective drawing
with some limited surface rendering. It is by no means a complete commercial package
yet. I will place it in the public domain shortly. Understanding the workings of
this program requires some knowledge of programming in PostScript. This ps3d program
will be available via ftp from <TT>www.ikra.com</TT> as soon as it's thoroughly commented.
Basically, the sample program is run this way:</P>
<PRE><FONT COLOR="#0066FF">$ ps3d < myfile.scr | ghostview -
</FONT></PRE>
<P>Or, if you prefer to store the output to a file instead, you can run the program
this way:</P>
<PRE><FONT COLOR="#0066FF">$ ps3d < myfile.scr > myout.ps.
</FONT></PRE>
<CENTER>
<H3><A NAME="Heading24<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>This chapter scratched the surface of a very important PostScript processing program
called Ghostscript. The executable file for Ghostscript is called gs. You can use
gs to decode PostScript files for displaying or printing hard copies.</P>
<P>Ghostscript is also used by other programs as a filter for working with PostScript
printers that cannot switch from PostScript to text and back just by looking at a
document. In this case, the <TT>gs</TT> command is used to convert text to PostScript
with an output filter for lp before sending the text to a PostScript printer. As
another example, FlexFAX uses gs as its primary PostScript output filter program.</P>
<P>Ghostview is an X Window-based program that provides a canvas for Ghostscript
to write its output to. Ghostview enables you to scroll through a multipage document,
zoom in and out, and save marked pages. The capability to view EPSI or PostScript
via Ghostscript saves time and paper when you're typesetting documents.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -