30 - 4   Custom Character and Symbol Definition

Generally, you will use TrueType fonts for displaying text on your screen and for printing. However, you can configure Tecplot 360 EX to use stroke fonts instead using the settings on the Rendering page of the Performance dialog (see “High Quality Font Usage” on page 456) or adding the USESTROKEFONTSONSCREEN and USESTROKEFONTSFOR3DTETXT macro commands to your configuration file (see “General Interface Configuration Options” on page 454). Stroke fonts define characters to be displayed on the screen using a set of straight lines (called strokes, naturally). Stroke fonts, if enabled, are also used in exported images (however, vector printing and file formats may use TrueType or PostScript fonts).

The stroke fonts are faster to draw than TrueType fonts, which can be important if you create plots with a lot of complex text. Another advantage of the stroke fonts is that you can redefine or modify the strokes that make up the characters, as they are stored in a plain text file called tecplot.fnt, which can be modified using an editor. For information on how to load a custom font file, see Section 30 - 1 “Custom Files loaded on Startup”.

The Font File is structured as follows:

#!FF 4
CharCellHeight
Stroke command set for Helvetica Font
Stroke command set for Greek Font
Stroke command set for Math Font
Stroke command set for User-Defined Font
Stroke command set for Times Font
Stroke command set for Times Italic Font
Stroke command set for Courier Font

The file type and version are on the first line ("FF" refers to Font File). CharCellHeight is the interline spacing (the height of a capital M plus some vertical space) in the units of a two-dimensional coordinate system used to define the stroke-font characters. The baseline of the characters is at zero. Before Tecplot 360 EX uses the character definitions, they are normalized by the character cell height.

Following the character cell height, there are seven sets of stroke commands, one set for each font as shown above. Each stroke command set consists of definitions for the characters in the font. Each font has a base set of 96 characters (character indices 32 to 127). Some fonts also include an extended set of characters (character indices 160 to 255). The extended characters are needed to complete the character sets for most of the common European languages.

All seven stroke command sets must be present, and each must have at least one character defined. Each stroke command set begins with the definition for a space (character index 32). After that, characters within a stroke command set may be defined in any order. If a character is not defined in the Font File, it is drawn as a blank.

Each character in a stroke command set is defined as follows:

CharIndex NumCommands CharWidth
Command1
Command2
Command3
.
.
.
Command
NumCommands

CharIndex is the character index that ranges from 32 to 127 and 160 to 255 for each font (see Table 18 - 2 for the matching of the character index to the English, Greek, Math, and standard User-Defined font characters). NumCommands is the number of stroke commands defining the character that follows. CharWidth is the character width, which determines the spacing of the characters.

A command may be in one of the following forms:

m x y.

d x y.

mr dx dy.

dr dx dy.

Where:

• A command that begins with an m is a move command.

• A command that begins with a d is a draw command.

• Commands mr and dr are relative move and relative draw commands.

• The x and y are the absolute coordinates within the character cell.

• The dx and dy are the relative coordinates with respect to the previous location (increments from the position attained by the previous command).

• All coordinates are specified as integers.

Figure 30-2 shows an example of a character cell and the commands used to define the lowercase letter "y". The height of the character cell is 48.

user_def_char_set.png

Figure 30-2. Defining a user-defined character.

Figure 30-3 shows a symbol being defined. Symbols should generally be centered about (0, 0) so that they are drawn centered on the point they mark (an exception might be an arrow symbol or similar, where you want the arrow's tip to indicate the marked point). The font file included with Tecplot 360 EX contains many User-Defined font stroke commands. Most of these are for creating extra plotting symbols, accessible when you use the Symbol Type "Other", enter an ASCII character, and specify the User-Defined font.

user_def_symbols.png

Figure 30-3. Defining a user-defined plotting symbol.