Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 698

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/doc/qws.doc:171 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Fonts in Qt/Embedded</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Fonts in Qt/Embedded</h1>

 
<p> <h2> Supported Formats
</h2>
<a name="1"></a><p> Qt/Embedded supports four font formats:
<p> <ul>
<li> <b>TrueType (TTF)</b> - the scalable font technology now standard
on MS-Windows and Apple Macintosh, and becoming popular on X11.
<li> <b>Postscript Type1 (PFA/PFB)</b> - scalable fonts often used by printers,
also popular on X11. These are similar in functionality to TTF
fonts and are not discussed further in this document.
<li> <b>Bitmap Distribution Format fonts (BDF)</b> - a standard format
for non-scalable fonts. A large number of BDF fonts are
supplied as part of standard X11 distributions - most of
these can be used with Qt/Embedded. You should <em>not</em>
use these in a production system: they are very slow to
load and take up a <em>lot</em> of storage space. Instead,
render the BDF to a QPF.
<li> <b>Qt Prerendered Font (QPF)</b> - a light-weight non-scalable font
format specific to Qt/Embedded.
</ul>
<p> Support for each of these font formats, except QPF which is always
enabled, can be enabled or disabled independently by using the <a href="emb-features.html">Qt/Embedded Features Definition</a>. There is
support in Qt/Embedded for writing a QPF font file from any font, thus
you can initially enable TTF and BDF formats, save QPF files for the
fonts and sizes you need, then remove TTF and BDF support.
<p> See <a href="makeqpf.html">tools/makeqpf</a> for a tool that helps
produce QPF files from the TTF and BDF, or just run your application
with the <tt>-savefonts</tt> option.
<p> <h2> Memory Requirements
</h2>
<a name="2"></a><p> With TTF fonts, each character in the font at a given point size is
only rendered when first used in a drawing or metrics operation. With
BDF fonts all characters are rendered when the font is used.
With QPF fonts, the characters are stored in the same format as Qt uses
when drawing.
<p> For example, a 10-point Times font containing the ASCII characters uses
around 1300 bytes when stored in QPF format.
<p> Taking advantage of the way the QPF format is structured, Qt/Embedded
memory-maps the data rather than reading and parsing it.
This reduces RAM consumption even further.
<p> Scalable fonts use a larger amount of memory per font, but
these fonts provide a memory saving if many different sizes of each
font are needed.
<p> <h2> Smooth Fonts
</h2>
<a name="3"></a><p> TTF, PFA, and QPF fonts can be rendered as <em>smooth</em> anti-aliased
fonts to give superior readability, especially on low-resolution
devices. The difference between smooth and non-smooth fonts is
illustrated below (you may need to change your display to low
resolution to see the difference):
<p> <center><img src="unsmooth.png" alt="unsmooth"></center> 
<p> <center><img src="smooth.png" alt="smooth"></center> 
<p> In Qt/Embedded 2.2.1, smooth fonts use 8 times as much memory as non-smooth
fonts. This multiplier will be reduced to a configurable
2 or 4 (ie. 4-level and 16-level shading rather than the current excessive
256-level shading).
<p> <h2> Unicode
</h2>
<a name="4"></a><p> All fonts used by Qt/Embedded use the Unicode character encoding.
Most fonts available today use this encoding, but they usually don't
contain all the Unicode characters. A <em>complete</em> 16-point Unicode
font uses over 1 MB of memory.
<p> <h2> The font definition file
</h2>
<a name="5"></a><p> When Qt/Embedded applications run, they look for a file called
<tt>$QTDIR/lib/fonts/fontdir</tt> or
<tt>/usr/local/qt-embedded/lib/fonts/fontdir</tt>. This file defines the
fonts available to the application. It has the following format:
<blockquote>
<em>name</em> <em>file</em> <em>renderer</em> <em>italic</em> <em>weight</em> <em>size</em> <em>flags</em>
</blockquote>
where
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Field <th valign="top">Value
<tr bgcolor="#f0f0f0"> <td valign="top"><em>name</em> <td valign="top"><tt>Helvetica</tt>, <tt>Times</tt>, etc.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>file</em> <td valign="top"><tt>helvR0810.bdf</tt>, <tt>verdana.ttf</tt>, etc.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>renderer</em> <td valign="top"><tt>BDF</tt> or <tt>FT</tt>
<tr bgcolor="#d0d0d0"> <td valign="top"><em>italic</em> <td valign="top"><tt>y</tt> or <tt>n</tt>
<tr bgcolor="#f0f0f0"> <td valign="top"><em>weight</em> <td valign="top"><tt>50</tt> is normal, <tt>75</tt> is bold, etc.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>size</em> <td valign="top"><tt>0</tt> for scalable or pointsize times 10 (e.g., <tt>120</tt>
for 12pt)
<tr bgcolor="#f0f0f0"> <td valign="top"><em>flags</em> <td valign="top"><ul>
<li> <tt>s</tt>: smooth (anti-aliased)
<li> <tt>u</tt>: unicode range when saving (default is Latin-1)
<li> <tt>a</tt>: ascii range when saving (default is Latin-1)
</ul>
</table></center>
<p> The font definition file does not specify QPF fonts; these are loaded 
directly from the directory containing the <tt>fontdir</tt> file, and must
be named <em>name</em>_<em>size</em>_<em>weight</em><em>italicflag</em>.qpf, where
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Field <th valign="top">Value
<tr bgcolor="#d0d0d0"> <td valign="top"><em>name</em> <td valign="top"><tt>helvetica</tt>, <tt>times</tt>, etc. (in lowercase)
<tr bgcolor="#f0f0f0"> <td valign="top"><em>size</em> <td valign="top">pointsize times 10 (e.g., <tt>120</tt> for 12pt)
<tr bgcolor="#d0d0d0"> <td valign="top"><em>italicflag</em> <td valign="top"><tt>i</tt> for italic, otherwise nothing.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>weight</em> <td valign="top"><tt>50</tt> is normal, <tt>75</tt> is bold, etc.
</table></center>
<p> If an application is run with the <tt>-savefonts</tt> command-line option,
then whenever a font other than a QPF font is used, a corresponding QPF file
is saved. This allows you to easily find the font usage of your applications
and to generate QPF files so that you can eventually reduce the memory
usage of your applications by disabling TTF and BDF support from Qt/Embedded,
or by modifying the initialization of <tt>qws_savefonts</tt> in
<tt>kernel/qapplication_qws.cpp</tt> of the Qt/Embedded library source code.
In extreme cases of memory-saving, it is possible to save partially-rendered
fonts (eg. only the characters in "Product Name<sup>TM</sup>") if you are
certain that these are the only characters you will need from the font.
See QMemoryManager::savePrerenderedFont() for this functionality.
<p> <h2> Notes
</h2>
<a name="6"></a><p> The font definition file, naming conventions for font files, and the format
of QPF files may change in versions of Qt/Embedded after 2.2.1.
<p> When enabled, Qt/Embedded uses the powerful FreeType2 library to implement
TrueType and Type1 support.
<p> 
<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>