ChartDirector 7.1 (.NET Edition)

Font Specification


Font Name

In ChartDirector for .NET, a font can be specified using the format:

{font name} [Bold] [Italic]

The followings are some examples:

Arial Bold
Times New Roman
Courier Bold Italic

When using the above format, you may use all fonts that are known to the operating system.

ChartDirector also supports using true-type fonts that are unknown to the operating system. This is useful if you are using private fonts in your application. The method is by specifying the font using the font file name. ChartDirector will search the font file in the "[windows]\fonts" directory as well as the "fonts" subdirectory (if it exists) under the application's base directory (AppDomain.CurrentDomain.BaseDirectory).

Indirect Font Names

ChartDirector supports several special keywords for specifying the font name indirectly. When these keywords are used as font names, ChartDirector will look up the actual font names from a font table. The keywords are as follows:

KeywordsDescription
"normal"This default normal font, which is the first font in the font table. This is initially mapped to "Arial".
"bold"The default bold font, which is the second font in the font table. This is initially mapped to "Arial Bold".
"italic"The default italic font, which is the third font in the font table. This is initially mapped to "Arial Italic".
"boldItalic"The default bold-italic font, which is the fourth font in the font table. This is initially mapped to "Arial Bold Italic" .
"fontN"The (N + 1)th font in the font table (the first font is "font0").

The font table can be modified using BaseChart.setFontTable or DrawArea.setFontTable.

The advantage of using indirect font names is that you can change the fonts fonts in your charts in one place.

Font Index

Most font files contain one font. However, it is possible a font file contains multiple fonts (that is, a font collection). For example, in True Type fonts, font files with extension ".ttc" may represent a font collection.

If a font file contains multiple font, the font index can be used to specify which font to use. By default, the font index is 0, which means the first font in the font file will be used.

Font Size

The font size decides how big a font will appear in the image. The font size is expressed in a font unit called points. This is the same unit used in common word processors.

Instead of specifying font size, some ChartDirector API (eg. TextBox.setFontSize) allow you to specify font height and font width separately. In ChartDirector for NET, only font height is used as the font size, and font width is ignored.

Font Color

This is the color to draw the font. (See Color Specification on how colors are represented in ChartDirector.)

Font Angle

This is the angle in degrees by which the font should be rotated anti-clockwise.

Vertical Layout

By default, text are laid out horizontally, with characters being drawn from left to right.

ChartDirector also supports vertical layout, with characters being drawn from top to bottom. For example, you may use BaseChart.addText to add text that are laid out vertically. Vertical layout is common for oriental languages such as Chinese, Japanese and Korean.