Font families

Use the fontFamily style attribute to define a generic or specific font family.

This section describes the possible values of the fontFamily style attribute.

Syntax

font-family [,...]
  1. font-family defines a generic or a native font family.

Usage

Sets of generic font families are supported. These are interpreted by the front-end depending on the graphical capability of the platform.

If the fontFamily is not a generic font family, it is interpreted as a native font family, which identifies a local font supported by the front-end. Usually, it is one of the fonts installed on the platform operating system. See front-end documentation for a list of supported native fonts.

Tip: It is recommended to use a generic font family instead of a native font family.

A native font family is used only if the front-end cannot determine a proper default font family for the desired platform.

Important: A font family containing white-spaces must be single quoted. In the XML definition of the style, this leads to a single quoted string that is, in turn, enclosed in double quotes:
<StyleAttribute name="fontFamily" value="'Courier New'" />
When specifying a comma-separated list of font families, the front-end uses the best matching font available on the platform. You can mix generic and native font families:
<StyleAttribute name="fontFamily" value="'Times New Roman',Times,serif" />
Table 1. Generic font families to front-end platform fonts
Generic font family name GDC GBC GMA GMI
serif Times serif (CSS) Serif Times New Roman
sans-serif Arial sans-serif (CSS) Sans-Serif Helvetica Neue
cursive Comic Sans Ms cursive (CSS) N/A (keeps default font) Marker Felt
fantasy Algerian fantasy (CSS) N/A (keeps default font) Papyrus
monospace Courier New monospace (CSS) Monospace Courier
Note:
  • The GBC front-end uses the font family as font-family property in a CSS style. For more details, see CSS generic-font-families
  • The GMI front-end tries to find a font family in the available fonts of the application (this means the iOS built-in fonts and any application-specific fonts) which matches the fontFamily given in the styles. If none is found, the fallback is "Helvetica Neue".
  • The GMA front-end maps generic font family names to Androidâ„¢ generic font names (Serif, Monospace), these are then mapped to real font names. The real font name depends on the Android brand. For example sans-serif is usually implemented with the "Roboto" font.

Example

<StyleAttribute name="fontFamily" value="sans-serif" />
<StyleAttribute name="fontFamily" value="'Courier New'" />
<StyleAttribute name="fontFamily" value="'Times New Roman',Times,serif" />