⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emb-fonts.html

📁 QT 下载资料仅供参考
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/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 standardon 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 TTFfonts and are not discussed further in this document.<li> <b>Bitmap Distribution Format fonts (BDF)</b> - a standard formatfor non-scalable fonts. A large number of BDF fonts aresupplied as part of standard X11 distributions - most ofthese can be used with Qt/Embedded. You should <em>not</em>use these in a production system: they are very slow toload 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 fontformat specific to Qt/Embedded.</ul><p> Support for each of these font formats, except QPF which is alwaysenabled, can be enabled or disabled independently by using the <a href="emb-features.html">Qt/Embedded Features Definition</a>. There issupport in Qt/Embedded for writing a QPF font file from any font, thusyou can initially enable TTF and BDF formats, save QPF files for thefonts and sizes you need, then remove TTF and BDF support.<p> See <a href="makeqpf.html">tools/makeqpf</a> for a tool that helpsproduce QPF files from the TTF and BDF, or just run your applicationwith 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 isonly rendered when first used in a drawing or metrics operation. WithBDF fonts all characters are rendered when the font is used.With QPF fonts, the characters are stored in the same format as Qt useswhen drawing.<p> For example, a 10-point Times font containing the ASCII characters usesaround 1300 bytes when stored in QPF format.<p> Taking advantage of the way the QPF format is structured, Qt/Embeddedmemory-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, butthese fonts provide a memory saving if many different sizes of eachfont 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-aliasedfonts to give superior readability, especially on low-resolutiondevices. The difference between smooth and non-smooth fonts isillustrated below (you may need to change your display to lowresolution 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-smoothfonts. This multiplier will be reduced to a configurable2 or 4 (ie. 4-level and 16-level shading rather than the current excessive256-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'tcontain all the Unicode characters. A <em>complete</em> 16-point Unicodefont 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 thefonts 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 mustbe 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 fileis saved. This allows you to easily find the font usage of your applicationsand to generate QPF files so that you can eventually reduce the memoryusage 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-renderedfonts (eg. only the characters in "Product Name<sup>TM</sup>") if you arecertain 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 formatof QPF files may change in versions of Qt/Embedded after 2.2.1.<p> When enabled, Qt/Embedded uses the powerful FreeType2 library to implementTrueType and Type1 support.<p> <!-- eof --><p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <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.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -