Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

[Contents]

Fonts

The Qtopia Core platform uses the FreeType 2 font engine to produce font output. For that reason it supports the same font formats as this font engine. In addition, Qtopia Core supports the Qt Prerendered Font (QPF), a light-weight non-scalable font format specific to Qtopia Core. Several of the formats may be rendered using anti-aliasing for improved readability on low-resolution devices.

When Qtopia Core applications run, they look for a file called fontdir in Qtopia Core's /lib/fonts/ directory defining the fonts that are available to the application (i.e. the fonts located in the /lib/fonts/ directory). Modify this file to specify the preferred fonts.

Support for other font formats can be added, contact info@trolltech.com for more information.

Optimization

Both the FreeType and QPF formats are features that can be disabled and enabled using Qtopia Core's feature definition system, reducing the size of Qt and saving resources.

Note that at least one font format must be defined.

See also Fine-Tuning Features.

All supported fonts use the Unicode character encoding. Most fonts available today do, but they usually don't contain all the Unicode characters. A complete 16-point Unicode font uses over 1 MB of memory.

Note that the font definition file, naming conventions for font files, and the format of QPF files may change in future versions of the Qtopia Core platform.

FreeType

By default, the FreeType 2 font engine (and Qtopia Core) supports the following font formats:

It is possible to add modules to the FreeType 2 font engine to support other types of font files. For more information, see the font engine's own website: http://freetype.sourceforge.net/freetype2/index.html.

Qt Prerendered Font

The Qt Prerendered Font (QPF) is a platform specific, light-weight and non-scalable font format.

With Qt/Embedded (Qtopia Core's predecessor) versions 2 and 3, it was possible to create custom QPF font files, for example creating QPF files from a TrueType (TTF) or Bitmap Distribution Format (BDF) font, removing the need for TTF and BDF support. Qt/Embedded also provided the makeqpf tool, located in Qt's tools directory, for producing QPF font files.

Note that the makeqpf tool is not yet ported to Qtopia Core.

Specifying Fonts

When Qtopia Core applications run, they look for a file called fontdir in Qt's /lib/fonts/ directory. Modify this file to specify the preferred fonts.

The file defines the fonts available to the application, and has the following format:

    name file renderer italic weight size flags

where

FieldValue
nameHelvetica, Times, etc.
filehelvR0810.bdf, verdana.ttf, etc.
rendererFT
italicy or n
weight50 is normal, 75 is bold, etc.
size0 for scalable or point size * 10 (i.e. 120 for 12pt)
flags
  • s: smooth (anti-aliased)
  • u: Unicode range when saving (default is Latin1)
  • a: ASCII range when saving (default is Latin1)

The font definition file does not specify QPF fonts; these are loaded directly from the directory containing the fontdir file. The font data is specified by the file name, for example helvetica_120_50.qpf is 12 point Helvetica while helvetica_120_50i.qpf is 12 point Helvetica italic.

[Contents]


Copyright © 2006 Trolltech Trademarks
Qt 4.1.3