Embedded Formatting Commands

Text strings can include embedded formatting commands that facilitate subscripting, superscripting, and equation formatting. The method used is similar to that developed by Grandle and Nystrom (1980). Embedded formatting commands are always introduced by the exclamation mark, (!). (The string “!!” is used to produce a literal exclamation mark.)

Tip: The TEXT graphics function can automatically convert from TeX-like text commands to IDL embedded-formatting commands.

Tip: Set the ENABLE_FORMATTING property on the IDLgrText object to use formatting commands in Object Graphics.

Note: Embedded formatting commands prefaced by the exclamation mark have no special significance for hardware-generated characters unless the ability is provided by the particular device in use. The IDL PostScript device driver accepts many of the standard embedded formatting commands, and is described here. To use hardware fonts with IDL Direct Graphics devices other than the PostScript device, consult the description of the device in IDL Direct Graphics Devices before trying to use these commands with hardware characters.

You can determine whether embedded formatting commands are available for use with device fonts on your current graphics device by inspecting bit 12 of the Flags field of the !D. Use the IDL statement:

IF (!D.FLAGS AND 4096) NE 0 THEN PRINT, 'Bit is set.'

to determine whether bit 12 of the Flags field is set for the current graphics device.

Changing Fonts within a String

You can change fonts one or more times within a text string using the embedded font commands shown in the table below. The character following the exclamation mark can be either upper or lower case.

Examples of commands used to change fonts in mid-string are included in Formatting Command Examples.

Command

Hershey Vector Font

TrueType Font

PostScript Font

!3

Simplex Roman (default)

Helvetica

Helvetica

!4

Simplex Greek

Helvetica Bold

Helvetica Bold

!5

Duplex Roman

Helvetica Italic

Helvetica Narrow

!6

Complex Roman

Helvetica Bold Italic

Helvetica Narrow Bold Oblique

!7

Complex Greek

Times

Times Roman

!8

Complex Italic

Times Italic

Times Bold Italic

!9

Math/special characters

Symbol

Symbol

!M

Math/special for 1 character

Symbol for 1 character

Symbol for 1 character

!10

Special characters

DejaVu Sans

Zapf Dingbats

!11 or !G

Gothic English

Courier

Courier

!12 or !W

Simplex Script

Courier Italic

Courier Oblique

!13

Complex Script

Courier Bold

Palatino

!14

Gothic Italian

Courier Bold Italic

Palatino Italic

!15

Gothic German

Times Bold

Palatino Bold

!16

Cyrillic

Times Bold Italic

Palatino Bold Italic

!17

Triplex Roman

DejaVuSans Bold

Avant Garde Book

!18

Triplex Italic

DejaVuSans Italic

New Century Schoolbook

!19

 

DejaVuSans Bold Italic

New Century Schoolbook Bold

!20

Miscellaneous

DejaVuSymbol

Undefined User Font

!V Miscellaneous for 1 character DejaVuSymbol for 1 character Ignored

!X

Revert to the entry font

Revert to the entry font

Revert to the entry font

Positioning Commands

The positioning and other font-manipulation commands are described in the following table. Examples of commands used to position text are included in Formatting Command Examples.

Command

Action

!A

Shift above the division line.

!B

Shift below the division line.

!C

"Carriage return", shift back to the starting position and down one line. This also performs a "!N", returning to the normal level and character size.

!D

Shift down to the first level subscript, shrink the character size by 38%.

!E

Shift up to the exponent level, shrink the character size by 56%.

!I

Shift down to the index level, shrink the character size by 56%.

!L

Shift down to the second level subscript, shrink the character size by 38%.

!M Switch to the !9 symbol font for one character, then switch back.

!N

Shift back to the normal level and original character size.

!R

Restore position from the top of the saved positions stack.

!S

Save position to the top of the saved positions stack.

!U

Shift to upper subscript level, shrink the character size by 38%.

!V

Switch to the !20 symbol font for one character, then switch back.

!X Return to the entry font.

!Z(u0,u1,...,un)

Each value within the parentheses will be interpreted as a 16-bit hexadecimal Unicode value. Values should be separated by commas.

!!

Display the ! symbol.

Version History

Original

Introduced

8.2 Change TrueType !10 from Symbol to DejaVuSans

8.6

Added DejaVu TrueType fonts !17, !18, !19, and !20.

8.6.1 Added !V formatting code for DejaVuSymbol font