Qt for Embedded Linux Fonts | Qt 5.9

Qt 5.9 | Qt for Embedded Linux Fonts

Qt 5.9.4 Reference Documentation

# Qt for Embedded Linux Fonts

Qt normally uses `fontconfig` to provide access to system fonts. If `fontconfig` is not available, e.g. in dedicated embedded systems where space is at a premium, Qt will fall back to using `QBasicFontDatabase`. In this case, Qt applications will look for fonts in Qt's `lib/fonts/` directory. Qt will automatically detect prerendered fonts and TrueType fonts.

Qt uses the FreeType 2 font engine to produce font output. The formats supported depends on the locally installed version of the FreeType library. When using QBasicFontDatabase, Qt also supports the Qt Prerendered Font format (QPF2), a light-weight non-scalable font formats. QPF2 is the native format of Qt for Embedded Linux 4.x.

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.

## FreeType Formats

The FreeType 2 library can support the following font formats:

- TrueType (TTF)
- PostScript Type1 (PFA/PFB)
- Bitmap Distribution Format (BDF)
- CID-keyed Type1
- Compact Font Format (CFF)
- OpenType fonts
- SFNT-based bitmap fonts
- Portable Compiled Format (PCF)
- Microsoft Windows Font File Format (Windows FNT)
- Portable Font Resource (PFR)
- Type 42 (limited support)

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.

Glyphs rendered using FreeType are shared efficiently between applications, reducing memory requirements and speeding up text rendering.

## Qt Prerendered Font (QPF2)

The Qt Prerendered Font (QPF2) is an architecture-independent, light-weight and non-scalable font format.

Qt comes with the cross-platform makeqpf tool, included in the `tools` directory, which allows generation of QPF2 files from system fonts.

QPF2 supports anti-aliasing and complex writing systems, using information from the corresponding TrueType font, if present on the system. The format is designed to be mapped directly to memory. The same format is used to share glyphs from non-prerendered fonts between applications.

## Legacy Qt Prerendered Font (QPF)

Qt provides support for the legacy QPF format for compatibility reasons. QPF is based on the internal font engine data structure of Qt/Embedded versions 2 and 3.

Note that the file name describes the font, for example `helvetica_120_50.qpf` is 12 point Helvetica while `helvetica_120_50i.qpf` is 12 point Helvetica italic.