<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/doc/src/emb-fonts.qdoc --> <head> <title>Qt 4.2: Fonts</title> <link rel="contents" href="qtopiacore.html" /> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><p> [<a href="qtopiacore.html">Contents</a>] </p> <h1 align="center">Fonts<br /><small></small></h1> <p>The Qtopia Core platform uses the <a href="http://freetype.sourceforge.net/freetype2/index.html">FreeType 2</a> 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 (<a href="#qpf">QPF</a>), 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.</p> <p>When Qtopia Core applications run, they look for a file called <tt>fontdir</tt> in Qtopia Core's <tt>/lib/fonts/</tt> directory defining the fonts that are available to the application (i.e. the fonts located in the <tt>/lib/fonts/</tt> directory). Modify this file to specify the preferred fonts.</p> <p>Support for other font formats can be added, contact <a href="mailto:info@trolltech.com">info@trolltech.com</a> for more information.</p> <p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><b>Optimization</b><p>Both the <a href="#freetype">FreeType</a> and <a href="#qpf">QPF</a> formats are features that can be disabled and enabled using Qtopia Core's feature definition system, reducing the size of Qt and saving resources.</p> <p>Note that at least one font format must be defined.</p> <p>See also <a href="qtopiacore-features.html">Fine-Tuning Features</a>.</p> </td><td><img src="images/qtopiacore-fontfeatures.png" /></td></tr> </table></p> <p>All supported fonts use the Unicode character encoding. Most fonts available today do, but they usually don't contain <i>all</i> the Unicode characters. A complete 16-point Unicode font uses over 1 MB of memory.</p> <p>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.</p> <ul><li><a href="#freetype">FreeType</a></li> <li><a href="#qt-prerendered-font">Qt Prerendered Font</a></li> <li><a href="#specifying-fonts">Specifying Fonts</a></li> </ul> <a name="freetype"></a> <h2>FreeType</h2> <p>By default, the <a href="http://freetype.sourceforge.net/freetype2/index.html">FreeType 2</a> font engine (and Qtopia Core) supports the following font formats:</p> <ul> <li>TrueType (TTF)</li> <li>PostScript Type1 (PFA/PFB)</li> <li>Bitmap Distribution Format (BDF)</li> <li>CID-keyed Type1</li> <li>Compact Font Format (CFF)</li> <li>OpenType fonts</li> <li>SFNT-based bitmap fonts</li> <li>Portable Compiled Format (PCF)</li> <li>Microsoft Windows Font File Format (Windows FNT)</li> <li>Portable Font Resource (PFR)</li> <li>Type 42 (limited support)</li> </ul> <p>It is possible to add modules to the <a href="http://freetype.sourceforge.net/freetype2/index.html">FreeType 2</a> font engine to support other types of font files. For more information, see the font engine's own website: <a href="http://freetype.sourceforge.net/freetype2/index.html">http://freetype.sourceforge.net/freetype2/index.html</a>.</p> <a name="qt-prerendered-font"></a> <h2>Qt Prerendered Font</h2> <a name="qpf"></a><p>The Qt Prerendered Font (QPF) is a platform specific, light-weight and non-scalable font format.</p> <p>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 <tt>makeqpf</tt> tool, located in Qt's <tt>tools</tt> directory, for producing QPF font files.</p> <p>Note that the <tt>makeqpf</tt> tool is not yet ported to Qtopia Core.</p> <a name="specifying-fonts"></a> <h2>Specifying Fonts</h2> <p>When Qtopia Core applications run, they look for a file called <tt>fontdir</tt> in Qt's <tt>/lib/fonts/</tt> directory. Modify this file to specify the preferred fonts.</p> <p>The file defines the fonts available to the application, and has the following format:</p> <pre> name file renderer italic weight size flags</pre> <p>where</p> <p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0"> <thead><tr valign="top" class="qt-style"><th>Field</th><th>Value</th></tr></thead> <tr valign="top" class="odd"><td><b>name</b></td><td><tt>Helvetica</tt>, <tt>Times</tt>, etc.</td></tr> <tr valign="top" class="even"><td><b>file</b></td><td><tt>helvR0810.bdf</tt>, <tt>verdana.ttf</tt>, etc.</td></tr> <tr valign="top" class="odd"><td><b>renderer</b></td><td><tt>FT</tt></td></tr> <tr valign="top" class="even"><td><b>italic</b></td><td><tt>y</tt> or <tt>n</tt></td></tr> <tr valign="top" class="odd"><td><b>weight</b></td><td><tt>50</tt> is normal, <tt>75</tt> is bold, etc.</td></tr> <tr valign="top" class="even"><td><b>size</b></td><td><tt>0</tt> for scalable or point size * 10 (i.e. <tt>120</tt> for 12pt)</td></tr> <tr valign="top" class="odd"><td><b>flags</b></td><td><ul> <li><tt>s</tt>: smooth (anti-aliased)</li> <li><tt>u</tt>: Unicode range when saving (default is Latin1)</li> <li><tt>a</tt>: ASCII range when saving (default is Latin1)</li> </ul> </td></tr> </table></p> <p>The font definition file does not specify <a href="#qpf">QPF</a> fonts; these are loaded directly from the directory containing the <tt>fontdir</tt> file. The font data is specified by the file name, for example <tt>helvetica_120_50.qpf</tt> is 12 point Helvetica while <tt>helvetica_120_50i.qpf</tt> is 12 point Helvetica <i>italic</i>.</p> <p> [<a href="qtopiacore.html">Contents</a>] </p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>