Search


Ploticus > Scripts >
Fonts, special characters, etc.




Non-ascii, extended ascii, and other special characters

Support depends on which graphics environment you're rendering in; see below.




Embedded newlines

In all graphics environments and fonts, ploticus recognizes backslash n (\\n) as representation of a newline, in all text that is displayed.




Inline superscripts and subscripts

In all graphics environments and fonts, ploticus (2.30+) recognizes the following inline constructs for representing superscripts and subscripts in all text that is displayed:
    ^ (carat) begins and ends superscript content
    ` (grave quote) begins and ends subscript content

See this example. Limitations: superscripts and subscripts render correctly only when using a monospace font such as the default GD fonts, default X11 fonts, or /Courier. In scripts, to ensure backward compatibility, this capability must be turned on using proc settings (see the example). Prefabs have this capability turned on by default.




Inline font changes and size changes

Not supported. However, each text attribute generally has a "details" attribute where font and size can be specified.




Math formulas

Not supported, other than superscript and subscripts.




What fonts are available?

This depends on what output format you are producing, since Ploticus does not include its own internal fonts.




PNG, GIF, etc.

If the default built-in GD code is used, a basic ascii font is available in 5 sizes (you can specify any point size in ploticus; the nearest available size will be used). You can't set the font from ploticus; -font (etc.) will have no effect. Vertical rendering is available. Availability of symbols and nonroman characters is limited to those in ASCII extended range. Note: some characters in the GD extended range don't agree with X11 or PostScript (there were apparently conflicting standards defining extended ascii). The GD character set is defined in gdfontg.c, which may be modified to suit if necessary.




PNG, JPEG, WBMP with FreeType2 support

If your ploticus build uses GD with FreeType2 support, you can use TrueType fonts. The basic GD ascii font is also available in 5 sizes (font name is ascii), and is the default. You can set the font from ploticus using -font, proc page font attribute, or font in any textdetails attribute.

To select a TrueType font, specify its file name, without the .ttf extension. Ploticus has no provision for mapping "font names" to TrueType file names. Eg. if you have a font file called times.ttf you would select it by saying:

    -font times

You will need to have some TrueType .ttf font files stored in a directory somewhere. The environment variable GDFONTPATH must be set to contain the pathname of this directory. TrueType font files may be found on win32 machines in c:/winnt/fonts or they may be downloaded on the web. Font file names containing embedded whitespace will likely be problematic.. if so rename (or soft-link) to a name that doesn't have embedded whitespace.

Vertical rendering is available. Availability of symbols and nonroman characters: Constructs such as À may be used, and unicode fonts can be used (see below).

Here is an example rendered using TTF sans serif font. For more information on building ploticus to use FreeType2, see ./src/FreeType2 and ./src/Makefile.




PostScript, EPS

Uses PostScript fonts. The default font is /Helvetica. (Postscript font names must always be written with the initial slash.) You can set the font from ploticus using -font, proc page font attribute, or font in any textdetails attribute, for example:
    -font /Helvetica-Oblique

Usually these fonts are available: /Helvetica /Helvica-Oblique /Helvetica-Bold /Helvetica-BoldOblique /Times-Roman /Times-Bold; many others are usually available as well. Vertical rendering is available. Availability of symbols and nonroman characters: As of version 2.01, the ploticus postscript driver supports ISO-LATIN encoding, so that European characters and symbols in ASCII extended range may be used. You can use the troff-like special characters feature that uses the /Symbols font.




SVG

If you're using SVG , font availablility and naming depends on the environment in effect where the SVG file is being viewed, ie. if you're viewing on MSIE on a win32 system see the list of fonts available in MS Word. SVG viewing environments generally are "intelligent" about font selection and substituting.

Ploticus uses a Helvetica as the default font. I've also used Courier, Times-Roman, Bookman, Stencil, Magneto, etc. You can set the font from ploticus using -font, proc page font attribute, or font in any textdetails attribute, for example:

    -font Times-Roman

Font file names containing embedded whitespace may be problematic.. if so rename (or soft-link) to a name that doesn't have embedded whitespace.

Vertical rendering is available. European characters and symbols in ASCII extended range may be used. Constructs such as À may be used, and unicode fonts can be used (see below) with utf-8 encoding.




SWF (flash)

The environment variable SWF_FONTS_DIR must be set to the full pathname of a directory containing your .fdb font files. The default will be Helvetica.fdb; you can select a font from the command line like this: -font Times-Roman which would then attempt to load Times-Roman.fdb from your SWF_FONTS_DIR directory. Helvetica.fdb and a few other fonts are available as accessories from the download page. Font file names containing embedded whitespace are problematic with ploticus' SWF driver.. rename (or soft-link) to a name that doesn't have embedded whitespace.




X11

Always uses the same fixed width font. You can't set the font from ploticus; -font (etc.) will have no effect. Depending on availablility, this will be either -adobe-courier-bold-r-normal, -misc-fixed-medium-r-normal, or as a last resort, 9x15. Proper vertical rendering is not available. Availability of symbols and nonroman characters is limited to those in ASCII extended range.




Unicode fonts

Unicode fonts may be used for titles, labels, tags, category names, etc. in the script or in data, if you are rendering in SVG or PNG/JPEG with FreeType2 (versions 2.05+). Unicode is not yet supported within dates.

Your ploticus script or prefab parameters should be utf-8 encoded. You will need a unicode TTF font such as Bitstream Cyberbit (freely downloadable on the internet). Set ploticus to use this font. For SVG, set the XML encoding to utf-8. Font and XML encoding can be set using proc settings , from the pl command line , or in a config file. ). PNG/JPEG can be viewed by standard means, since the fonts have already been rendered and do not need to be available to the viewer application. SVG must be viewed by an application that can work with your Unicode font(s) (MSIE browser currently seems to do the best job).




Examples

This example shows the ascii and Western European range that is available by default.




This example demonstrates rendering of Chinese using a unicode font.




This example demonstrates superscripts and subscripts.



 


Ploticus 2.42 ... May 2013 Terms of use /