1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qplatformfontdatabase_qpa.cpp -->
<title>Qt 4.8: QPlatformFontDatabase Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QPlatformFontDatabase</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QPlatformFontDatabase Class Reference</h1>
<!-- $$$QPlatformFontDatabase-brief -->
<p>The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are rendered <a href="#details">More...</a></p>
<!-- @@@QPlatformFontDatabase -->
<pre class="cpp"> <span class="preprocessor">#include <QPlatformFontDatabase></span></pre><p>This class was introduced in Qt 4.8.</p>
<ul>
<li><a href="qplatformfontdatabase-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QStringList </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#addApplicationFont">addApplicationFont</a></b> ( const QByteArray & <i>fontData</i>, const QString & <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QStringList </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#fallbacksForFamily">fallbacksForFamily</a></b> ( const QString <i>family</i>, const QFont::Style & <i>style</i>, const QFont::StyleHint & <i>styleHint</i>, const QUnicodeTables::Script & <i>script</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#fontDir">fontDir</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QFontEngine * </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#fontEngine">fontEngine</a></b> ( const QFontDef & <i>fontDef</i>, QUnicodeTables::Script <i>script</i>, void * <i>handle</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QFontEngine * </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#fontEngine-2">fontEngine</a></b> ( const QByteArray & <i>fontData</i>, qreal <i>pixelSize</i>, QFont::HintingPreference <i>hintingPreference</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#populateFontDatabase">populateFontDatabase</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#releaseHandle">releaseHandle</a></b> ( void * <i>handle</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#registerFont">registerFont</a></b> ( const QString & <i>familyName</i>, const QString & <i>foundryName</i>, QFont::Weight <i>weight</i>, QFont::Style <i>style</i>, QFont::Stretch <i>stretch</i>, bool <i>antialiased</i>, bool <i>scalable</i>, int <i>pixelSize</i>, const QSupportedWritingSystems & <i>writingSystems</i>, void * <i>usrPtr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qplatformfontdatabase.html#registerQPF2Font">registerQPF2Font</a></b> ( const QByteArray & <i>dataArray</i>, void * <i>handle</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QPlatformFontDatabase-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they are rendered</p>
<p>QPlatformFontDatabase is the superclass which is intended to let platform implementations use native font handling.</p>
<p>Qt has its internal font database which it uses to discover available fonts on the user's system. To be able to populate this database subclass this class, and reimplement <a href="qplatformfontdatabase.html#populateFontDatabase">populateFontDatabase</a>().</p>
<p>Use the function <a href="qplatformfontdatabase.html#registerFont">registerFont</a>() to populate the internal font database.</p>
<p>Sometimes a specified font does not have the required glyphs; in such a case, the fallbackForFamily() function is called automatically to find alternative font families that can supply alternatives to the missing glyphs.</p>
</div>
<p><b>See also </b><a href="qsupportedwritingsystems.html">QSupportedWritingSystems</a>.</p>
<!-- @@@QPlatformFontDatabase -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$addApplicationFont[overload1]$$$addApplicationFontconstQByteArray&constQString& -->
<h3 class="fn"><a name="addApplicationFont"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QPlatformFontDatabase::<span class="name">addApplicationFont</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>fontData</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>fileName</i> )<tt> [virtual]</tt></h3>
<p>Adds an application font described by the font contained supplied <i>fontData</i> or using the font contained in the file referenced by <i>fileName</i>. Returns a list of family names, or an empty list if the font could not be added.</p>
<p><b>Note:</b> The default implementation of this function does not add an application font. Subclasses should reimplement this function to perform the necessary loading and registration of fonts.</p>
<!-- @@@addApplicationFont -->
<!-- $$$fallbacksForFamily[overload1]$$$fallbacksForFamilyconstQStringconstQFont::Style&constQFont::StyleHint&constQUnicodeTables::Script& -->
<h3 class="fn"><a name="fallbacksForFamily"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QPlatformFontDatabase::<span class="name">fallbacksForFamily</span> ( const <span class="type"><a href="qstring.html">QString</a></span> <i>family</i>, const <span class="type"><a href="qfont.html#Style-enum">QFont::Style</a></span> & <i>style</i>, const <span class="type"><a href="qfont.html#StyleHint-enum">QFont::StyleHint</a></span> & <i>styleHint</i>, const <span class="type"><a href="qunicodetables.html#Script-enum">QUnicodeTables::Script</a></span> & <i>script</i> ) const<tt> [virtual]</tt></h3>
<p>Returns a list of alternative fonts for the specified <i>family</i> and <i>style</i> and <i>script</i> using the <i>styleHint</i> given.</p>
<!-- @@@fallbacksForFamily -->
<!-- $$$fontDir[overload1]$$$fontDir -->
<h3 class="fn"><a name="fontDir"></a><span class="type"><a href="qstring.html">QString</a></span> QPlatformFontDatabase::<span class="name">fontDir</span> () const<tt> [virtual]</tt></h3>
<p>Returns the path to the font directory.</p>
<p>The font directory is stored in the general Qt settings unless it has been overridden by the <tt>QT_QPA_FONTDIR</tt> environment variable.</p>
<p>When using builds of Qt that do not support settings, the <tt>QT_QPA_FONTDIR</tt> environment variable is the only way to specify the font directory.</p>
<!-- @@@fontDir -->
<!-- $$$fontEngine[overload1]$$$fontEngineconstQFontDef&QUnicodeTables::Scriptvoid* -->
<h3 class="fn"><a name="fontEngine"></a><span class="type">QFontEngine</span> * QPlatformFontDatabase::<span class="name">fontEngine</span> ( const <span class="type">QFontDef</span> & <i>fontDef</i>, <span class="type"><a href="qunicodetables.html#Script-enum">QUnicodeTables::Script</a></span> <i>script</i>, <span class="type">void</span> * <i>handle</i> )<tt> [virtual]</tt></h3>
<p>Returns the font engine that can be used to render the font described by the font definition, <i>fontDef</i>, in the specified <i>script</i>.</p>
<!-- @@@fontEngine -->
<!-- $$$fontEngine$$$fontEngineconstQByteArray&qrealQFont::HintingPreference -->
<h3 class="fn"><a name="fontEngine-2"></a><span class="type">QFontEngine</span> * QPlatformFontDatabase::<span class="name">fontEngine</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>fontData</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>pixelSize</i>, <span class="type"><a href="qfont.html#HintingPreference-enum">QFont::HintingPreference</a></span> <i>hintingPreference</i> )<tt> [virtual]</tt></h3>
<!-- @@@fontEngine -->
<!-- $$$populateFontDatabase[overload1]$$$populateFontDatabase -->
<h3 class="fn"><a name="populateFontDatabase"></a><span class="type">void</span> QPlatformFontDatabase::<span class="name">populateFontDatabase</span> ()<tt> [virtual]</tt></h3>
<p>This function is called once at startup by Qts internal fontdatabase. Reimplement this function in a subclass for a convenient place to initialise the internal fontdatabase.</p>
<p>The default implementation looks in the <a href="qplatformfontdatabase.html#fontDir">fontDir</a>() location and registers all qpf2 fonts.</p>
<!-- @@@populateFontDatabase -->
<!-- $$$registerFont[overload1]$$$registerFontconstQString&constQString&QFont::WeightQFont::StyleQFont::StretchboolboolintconstQSupportedWritingSystems&void* -->
<h3 class="fn"><a name="registerFont"></a><span class="type">void</span> QPlatformFontDatabase::<span class="name">registerFont</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>familyName</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>foundryName</i>, <span class="type"><a href="qfont.html#Weight-enum">QFont::Weight</a></span> <i>weight</i>, <span class="type"><a href="qfont.html#Style-enum">QFont::Style</a></span> <i>style</i>, <span class="type"><a href="qfont.html#Stretch-enum">QFont::Stretch</a></span> <i>stretch</i>, <span class="type">bool</span> <i>antialiased</i>, <span class="type">bool</span> <i>scalable</i>, <span class="type">int</span> <i>pixelSize</i>, const <span class="type"><a href="qsupportedwritingsystems.html">QSupportedWritingSystems</a></span> & <i>writingSystems</i>, <span class="type">void</span> * <i>usrPtr</i> )<tt> [static]</tt></h3>
<p>Registers a font with the given set of attributes describing the font's foundry, family name, style and stretch information, pixel size, and supported writing systems. Additional information about whether the font can be scaled and antialiased can also be provided.</p>
<p>The foundry name and font family are described by <i>foundryName</i> and <i>familyName</i>. The font weight (light, normal, bold, etc.), style (normal, oblique, italic) and stretch information (condensed, expanded, unstretched, etc.) are specified by <i>weight</i>, <i>style</i> and <i>stretch</i>.</p>
<p>Some fonts can be antialiased and scaled; <i>scalable</i> and <i>antialiased</i> can be set to true for fonts with these attributes. The intended pixel size of non-scalable fonts is specified by <i>pixelSize</i>; this value will be ignored for scalable fonts.</p>
<p>The writing systems supported by the font are specified by the <i>writingSystems</i> argument.</p>
<p><b>See also </b><a href="qplatformfontdatabase.html#registerQPF2Font">registerQPF2Font</a>().</p>
<!-- @@@registerFont -->
<!-- $$$registerQPF2Font[overload1]$$$registerQPF2FontconstQByteArray&void* -->
<h3 class="fn"><a name="registerQPF2Font"></a><span class="type">void</span> QPlatformFontDatabase::<span class="name">registerQPF2Font</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>dataArray</i>, <span class="type">void</span> * <i>handle</i> )<tt> [static]</tt></h3>
<p>Registers the pre-rendered QPF2 font contained in the given <i>dataArray</i>.</p>
<p><b>See also </b><a href="qplatformfontdatabase.html#registerFont">registerFont</a>().</p>
<!-- @@@registerQPF2Font -->
<!-- $$$releaseHandle[overload1]$$$releaseHandlevoid* -->
<h3 class="fn"><a name="releaseHandle"></a><span class="type">void</span> QPlatformFontDatabase::<span class="name">releaseHandle</span> ( <span class="type">void</span> * <i>handle</i> )<tt> [virtual]</tt></h3>
<p>Releases the font handle and deletes any associated data loaded from a file.</p>
<!-- @@@releaseHandle -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|