Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR02 / Books / gnuplot 4.6 manual.pdf
Скачиваний:
55
Добавлен:
18.03.2015
Размер:
2.22 Mб
Скачать

210 gnuplot 4.6

Pango, the library used to layout the text, is based on utf-8. Thus, the pngcairo terminal has to convert from your encoding to utf-8. The default input encoding is based on your 'locale'. If you want to use another encoding, make sure gnuplot knows which one you are using. See encoding (p. 110) for more details.

Pango may give unexpected results with fonts that do not respect the unicode mapping. With the Symbol font, for example, the pngcairo terminal will use the map provided by http://www.unicode.org/ to translate character codes to unicode. Note that "the Symbol font" is to be understood as the Adobe Symbol font, distributed with Acrobat Reader as "SY .PFB". Alternatively, the OpenSymbol font, distributed with OpenO ce.org as "opens .ttf", o ers the same characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a di erent character set with several missing or moved mathematic characters. If you experience problems with your default setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to install one of the Adobe or OpenO ce Symbol fonts, and remove the Microsoft one. Other non-conform fonts, such as "wingdings" have been observed working.

The rendering of the plot cannot be altered yet. To obtain the best output possible, the rendering involves two mechanisms : antialiasing and oversampling. Antialiasing allows to display non-horizontal and non-vertical lines smoother. Oversampling combined with antialiasing provides subpixel accuracy, so that gnuplot can draw a line from non-integer coordinates. This avoids wobbling e ects on diagonal lines ('plot x' for example).

Postscript

Several options may be set in the postscript driver.

Syntax:

set terminal postscript {default}

set terminal postscript {landscape | portrait | eps} {enhanced | noenhanced} {defaultplex | simplex | duplex}

{fontfile [add | delete] "<filename>" | nofontfiles} {{no}adobeglyphnames} {level1 | leveldefault}

{color | colour | monochrome} {background <rgbcolor> | nobackground} {solid | dashed}

{dashlength | dl <DL>} {linewidth | lw <LW>} {rounded | butt} {clip | noclip}

{palfuncparam <samples>{,<maxdeviation>}} {size <XX>{unit},<YY>{unit}}

{blacktext | colortext | colourtext} {{font} "fontname{,fontsize}" {<fontsize>}} {fontscale <scale>}

If you see the error message

"Can't find PostScript prologue file ... "

Please see and follow the instructions in postscript prologue (p. 213).

landscape and portrait choose the plot orientation. eps mode generates EPS (Encapsulated PostScript) output, which is just regular PostScript with some additional lines that allow the le to be imported into a variety of other applications. (The added lines are PostScript comment lines, so the le may still be printed by itself.) To get EPS output, use the eps mode and make only one plot per le. In eps mode the whole plot, including the fonts, is reduced to half of the default size.

enhanced enables enhanced text mode features (subscripts, superscripts and mixed fonts). See enhanced (p. 23) for more information. blacktext forces all text to be written in black even in color mode;

Duplexing in PostScript is the ability of the printer to print on both sides of the same sheet of paper. With defaultplex, the default setting of the printer is used; with simplex only one side is printed; duplex prints on both sides (ignored if your printer can't do it).

gnuplot 4.6

211

"<fontname>" is the name of a valid PostScript font; and <fontsize> is the size of the font in PostScript points. In addition to the standard postscript fonts, an oblique version of the Symbol font, useful for mathematics, is de ned. It is called "Symbol-Oblique".

default sets all options to their defaults: landscape, monochrome, dashed, dl 1.0, lw 1.0, defaultplex, noenhanced, "Helvetica" and 14pt. Default size of a PostScript plot is 10 inches wide and 7 inches high. The option color enables color, while monochrome prefers black and white drawing elements. Further, monochrome uses gray palette but it does not change color of objects speci ed with an explicit colorspec. solid draws all plots with solid lines, overriding any dashed patterns. dashlength or dl scales the length of the dashed-line segments by <DL>, which is a oating-point number greater than zero. linewidth or lw scales all linewidths by <LW>.

By default the generated PostScript code uses language features that were introduced in PostScript Level 2, notably lters and patternll of irregular objects such as lledcurves. PostScript Level 2 features are conditionally protected so that PostScript Level 1 interpreters do not issue errors but, rather, display a message or a PostScript Level 1 approximation. The level1 option substitutes PostScript Level 1 approximations of these features and uses no PostScript Level 2 code. This may be required by some old printers and old versions of Adobe Illustrator. The ag level1 can be toggled later by editing a single line in the PostScript output le to force PostScript Level 1 interpretation. In the case of les containing level 2 code, the above features will not appear or will be replaced by a note when this ag is set or when the interpreting program does not indicate that it understands level 2 PostScript or higher.

rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.

clip tells PostScript to clip all output to the bounding box; noclip is the default.

palfuncparam controls how set palette functions are encoded as gradients in the output. Analytic color component functions (set via set palette functions) are encoded as linear interpolated gradients in the postscript output: The color component functions are sampled at <samples> points and all points are removed from this gradient which can be removed without changing the resulting colors by more than <maxdeviation>. For almost every useful palette you may safely leave the defaults of <samples>=2000 and <maxdeviation>=0.003 untouched.

The default size for postscript output is 10 inches x 7 inches. The default for eps output is 5 x 3.5 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possibly (currently only cm). The BoundingBox of the plot is correctly adjusted to contain the resized image. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as speci ed by the size option. NB: this is a change from the previously recommended method of using the set size command prior to setting the terminal type. The old method left the BoundingBox unchanged and screen coordinates did not correspond to the actual limits of the plot.

Fonts listed by font le or font le add encapsulate the font de nitions of the listed font from a postscript Type 1 or TrueType font le directly into the gnuplot output postscript le. Thus, the enclosed font can be used in labels, titles, etc. See the section postscript font le (p. 212) for more details. With font le delete, a font le is deleted from the list of embedded les. nofont les cleans the list of embedded fonts.

Examples:

 

set terminal postscript default

# old postscript

set terminal postscript enhanced

# old enhpost

set terminal postscript landscape 22

# old psbig

set terminal postscript eps 14

# old epsf1

set terminal postscript eps 22

# old epsf2

set size 0.7,1.4; set term post portrait color "Times-Roman" 14 set term post "VAGRoundedBT_Regular" 14 fontfile "bvrr8a.pfa"

Linewidths and pointsizes may be changed with set style line.

The postscript driver supports about 70 distinct pointtypes, selectable through the pointtype option on plot and set style line.

Several possibly useful les about gnuplot's PostScript are included in the /docs/psdoc subdirectory of the gnuplot distribution and at the distribution sites. These are "ps symbols.gpi" (a gnuplot command le that, when executed, creates the le "ps symbols.ps" which shows all the symbols available through the postscript terminal), "ps guide.ps" (a PostScript le that contains a summary of the enhanced syntax and

212

gnuplot 4.6

a page showing what the octal codes produce with text and symbol fonts), "ps le.doc" (a text le that contains a discussion of the organization of a PostScript le written by gnuplot), and "ps font le doc.tex" (a LaTeX le which contains a short documentation concerning the encapsulation of LaTeX fonts with a glyph table of the math fonts).

A PostScript le is editable, so once gnuplot has created one, you are free to modify it to your heart's desire. See the editing postscript (p. 212) section for some hints.

Editing postscript

The PostScript language is a very complex language | far too complex to describe in any detail in this document. Nevertheless there are some things in a PostScript le written by gnuplot that can be changed without risk of introducing fatal errors into the le.

For example, the PostScript statement "/Color true def" (written into the le in response to the command set terminal postscript color), may be altered in an obvious way to generate a black-and-white version of a plot. Similarly line colors, text colors, line weights and symbol sizes can also be altered in straight-forward ways. Text (titles and labels) can be edited to correct misspellings or to change fonts. Anything can be repositioned, and of course anything can be added or deleted, but modi cations such as these may require deeper knowledge of the PostScript language.

The organization of a PostScript le written by gnuplot is discussed in the text le "ps le.doc" in the docs/ps subdirectory of the gnuplot source distribution.

Postscript font le

The font le or font le add option takes one le name as argument and encapsulates this le into the postscript output in order to make this font available for text elements (labels, tic marks, titles, etc.). The font le delete option also takes one le name as argument. It deletes this le name from the list of encapsulated les.

The postscript terminal understands some font le formats: Type 1 fonts in ASCII le format (extension ".pfa"), Type 1 fonts in binary le format (extension ".pfb"), and TrueType fonts (extension ".ttf"). Pfales are understood directly, pfb and ttf les are converted on the y if appropriate conversion tools are installed (see below). You have to specify the full lename including the extension. Each font le option takes exact one font le name. This option can be used multiple times in order to include more than one font le.

The font le is searched in the working directory and in all directories listed in the fontpath which is determined by set fontpath. In addition, the fontpath can be set using the environment variable GNUPLOT FONTPATH. If this is not set a system dependent default search list is used. See set fontpath (p. 111) for more details.

For using the encapsulated font le you have to specify the font name (which normally is not the same as the le name). When embedding a font le by using the font le option in interactive mode, the font name is printed on the screen. E.g.

Font file 'p052004l.pfb' contains the font 'URWPalladioL-Bold'. Location: /usr/lib/X11/fonts/URW/p052004l.pfb

When using pfa or pfb fonts, you can also nd it out by looking into the font le. There is a line similar to "/FontName /URWPalladioL-Bold def". The middle string without the slash is the fontname, here "URWPalladioL-Bold". For TrueType fonts, this is not so easy since the font name is stored in a binary format. In addition, they often have spaces in the font names which is not supported by Type 1 fonts (in which a TrueType is converted on the y). The font names are changed in order to eliminate the spaces in the fontnames. The easiest way to nd out which font name is generated for use with gnuplot, start gnuplot in interactive mode and type in "set terminal postscript font le '< lename.ttf>'".

For converting font les (either ttf or pfb) to pfa format, the conversion tool has to read the font from a le and write it to standard output. If the output cannot be written to standard output, on-the- y conversion is not possible.

gnuplot 4.6

213

For pfb les "pfbtops" is a tool which can do this. If this program is installed on your system the on the y conversion should work. Just try to encapsulate a pfb le. If the compiled in program call does not work correctly you can specify how this program is called by de ning the environment variable GNUPLOT PFBTOPFA e.g. to "pfbtops %s". The %s will be replaced by the font le name and thus has to exist in the string.

If you don't want to do the conversion on the y but get a pfa le of the font you can use the tool "pfb2pfa" which is written in simple c and should compile with any c compiler. It is available from many ftp servers, e.g.

ftp://ftp.dante.de/tex-archive/fonts/utilities/ps2mf/

In fact, "pfbtopfa" and "pfb2ps" do the same job. "pfbtopfa" puts the resulting pfa code into a le, whereas "pfbtops" writes it to standard output.

TrueType fonts are converted into Type 1 pfa format, e.g. by using the tool "ttf2pt1" which is available from

http://ttf2pt1.sourceforge.net/

If the builtin conversion does not work, the conversion command can be changed by the environment variable GNUPLOT TTFTOPFA. For usage with ttf2pt1 it may be set to "ttf2pt1 -a -e -W 0 %s - ". Here again, %s stands for the le name.

For special purposes you also can use a pipe (if available for your operating system). Therefore you start the le name de nition with the character "<" and append a program call. This program has to write pfa data to standard output. Thus, a pfa le may be accessed by set font le "< cat garamond.pfa".

For example, including Type 1 font les can be used for including the postscript output in LaTeX documents. The "european computer modern" font (which is a variant of the "computer modern" font) is available in pfb format from any CTAN server, e.g.

ftp://ftp.dante.de/tex-archive/fonts/ps-type1/cm-super/

For example, the le "sfrm1000.pfb" contains the normal upright fonts with serifs in the design size 10pt (font name "SFRM1000"). The computer modern fonts, which are still necessary for mathematics, are available from

ftp://ftp.dante.de/tex-archive/fonts/cm/ps-type1/bluesky

With these you can use any character available in TeX. However, the computer modern fonts have a strange encoding. (This is why you should not use cmr10.pfb for text, but sfrm1000.pfb instead.) The usage of TeX fonts is shown in one of the demos. The le "ps font le doc.tex" in the /docs/psdoc subdirectory of the gnuplot source distribution contains a table with glyphs of the TeX mathfonts.

If the font "CMEX10" is embedded ( le "cmex10.pfb") gnuplot de nes the additional font "CMEX10Baseline". It is shifted vertically in order to t better to the other glyphs (CMEX10 has its baseline at the top of the symbols).

Postscript prologue

Each PostScript output le includes a %%Prolog section and possibly some additional user-de ned sections containing, for example, character encodings. These sections are copied from a set of PostScript prologueles that are either compiled into the gnuplot executable or stored elsewhere on your computer. A default directory where these les live is set at the time gnuplot is built. However, you can override this default either by using the gnuplot command set psdir or by de ning an environment variable GNUPLOT PS DIR. See set psdir (p. 143).

Postscript adobeglyphnames

This setting is only relevant to PostScript output with UTF-8 encoding. It controls the names used to describe characters with Unicode entry points higher than 0x00FF. That is, all characters outside of the Latin1 set. In general unicode characters do not have a unique name; they have only a unicode identi cation code. However, Adobe have a recommended scheme for assigning names to certain ranges of characters (extended Latin, Greek, etc). Some fonts use this scheme, others do not. By default, gnuplot will use

Соседние файлы в папке Books