You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
8.7 KiB
170 lines
8.7 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/qws.doc:185 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>Fonts in TQt/Embedded</title>
|
||
|
<style type="text/css"><!--
|
||
|
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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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 TQt/Embedded</h1>
|
||
|
|
||
|
|
||
|
<p> <h2> Supported Formats
|
||
|
</h2>
|
||
|
<a name="1"></a><p> TQt/Embedded supports four font formats:
|
||
|
<p> <center><table cellpadding="4" cellspacing="2" border="0">
|
||
|
<tr bgcolor="#f0f0f0">
|
||
|
<td valign="top"><b>TrueType (TTF)</b>
|
||
|
<td valign="top">The scalable font technology now standard on MS-Windows and Apple
|
||
|
Macintosh, and becoming popular on X11.
|
||
|
<tr bgcolor="#d0d0d0">
|
||
|
<td valign="top"><b>Postscript Type1 (PFA/PFB)</b>
|
||
|
<td valign="top">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.
|
||
|
<tr bgcolor="#f0f0f0">
|
||
|
<td valign="top"><b>Bitmap Distribution Format<br>fonts (BDF)</b>
|
||
|
<td valign="top">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 TQt/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 TQPF.
|
||
|
<tr bgcolor="#d0d0d0">
|
||
|
<td valign="top"><b>TQt Prerendered Font (TQPF)</b>
|
||
|
<td valign="top">A light-weight non-scalable font format specific to TQt/Embedded.
|
||
|
</table></center>
|
||
|
<p> Support for each of these font formats (except TQPF which is always
|
||
|
enabled) can be enabled or disabled independently by using the <a href="emb-features.html">TQt/Embedded Features Definition</a>. There is
|
||
|
support in TQt/Embedded for writing a TQPF font file from any font, so
|
||
|
you can initially enable TTF and BDF formats, save TQPF 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 TQPF files from the TTF and BDF, or just run your application
|
||
|
with the <tt>-savefonts</tt> option.
|
||
|
<p> <h2> Memory Retquirements
|
||
|
</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 TQPF fonts, the characters are stored in the same format that TQt
|
||
|
uses for drawing.
|
||
|
<p> For example, a 10-point Times font containing the ASCII characters uses
|
||
|
around 1300 bytes when stored in TQPF format.
|
||
|
<p> Taking advantage of the way the TQPF format is structured, TQt/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 TQPF 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> <h2> Unicode
|
||
|
</h2>
|
||
|
<a name="4"></a><p> All fonts used by TQt/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 TQt/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 point size * 10 (i.e. <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 TQPF 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">point size * 10 (i.e. <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 TQPF font is used, a corresponding TQPF file
|
||
|
is saved. This allows you to easily find the font usage of your applications
|
||
|
and to generate TQPF files so that you can eventually reduce the memory
|
||
|
usage of your applications by disabling TTF and BDF support from TQt/Embedded,
|
||
|
or by modifying the initialization of <tt>qws_savefonts</tt> in
|
||
|
<tt>kernel/qapplication_qws.cpp</tt> of the TQt/Embedded library source code.
|
||
|
In extreme cases of memory-saving, it is possible to save partially-rendered
|
||
|
fonts (i.e. 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 TQMemoryManager::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 TQPF files may change in versions of TQt/Embedded after 3.
|
||
|
<p>
|
||
|
To generate TQPF files of different rotations, the program must be re-run with
|
||
|
an orientation that matches the desired rotation of the TQPF output. An example to
|
||
|
generate all 4 rotations of fonts would be to run the following at a real framebuffer:
|
||
|
<pre>
|
||
|
for dpy in LinuxFb Transformed:Rot90 Transformed:Rot180 Transformed:Rot270
|
||
|
do
|
||
|
TQWS_DISPLAY=$dpy ./makeqpf "$@"
|
||
|
done
|
||
|
</pre><p> If programs are only ever run in one orientation on a device, only the one
|
||
|
appropriate set of fonts is needed.
|
||
|
<p>
|
||
|
When enabled, TQt/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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|