source: trunk/doc/html/qfont-h.html@ 203

Last change on this file since 203 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 10.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qfont.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qfont.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qfont.h</h1>
33
34<p>This is the verbatim text of the qfont.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: qfont-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QFont class
41**
42** Created : 940514
43**
44** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
45**
46** This file is part of the kernel module of the Qt GUI Toolkit.
47**
48** This file may be distributed under the terms of the Q Public License
49** as defined by Trolltech ASA of Norway and appearing in the file
50** LICENSE.QPL included in the packaging of this file.
51**
52** This file may be distributed and/or modified under the terms of the
53** GNU General Public License version 2 as published by the Free Software
54** Foundation and appearing in the file LICENSE.GPL included in the
55** packaging of this file.
56**
57** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
58** licenses may use this file in accordance with the Qt Commercial License
59** Agreement provided with the Software.
60**
61** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
62** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63**
64** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
65** information about Qt Commercial License Agreements.
66** See http://www.trolltech.com/qpl/ for QPL licensing information.
67** See http://www.trolltech.com/gpl/ for GPL licensing information.
68**
69** Contact info@trolltech.com if any conditions of this licensing are
70** not clear to you.
71**
72**********************************************************************/
73
74#ifndef QFONT_H
75#define QFONT_H
76
77#ifndef QT_H
78#include "qwindowdefs.h"
79#include "qstring.h"
80#endif // QT_H
81
82
83class QFontPrivate; /* don't touch */
84class QStringList;
85class QTextFormatCollection;
86
87class Q_EXPORT QFont
88{
89public:
90 enum StyleHint {
91 Helvetica, SansSerif = Helvetica,
92 Times, Serif = Times,
93 Courier, TypeWriter = Courier,
94 OldEnglish, Decorative = OldEnglish,
95 System,
96 AnyStyle
97 };
98
99 enum StyleStrategy {
100 PreferDefault = 0x0001,
101 PreferBitmap = 0x0002,
102 PreferDevice = 0x0004,
103 PreferOutline = 0x0008,
104 ForceOutline = 0x0010,
105 PreferMatch = 0x0020,
106 PreferQuality = 0x0040,
107 PreferAntialias = 0x0080,
108 NoAntialias = 0x0100,
109 OpenGLCompatible = 0x0200
110 };
111
112 enum Weight {
113 Light = 25,
114 Normal = 50,
115 DemiBold = 63,
116 Bold = 75,
117 Black = 87
118 };
119
120 enum Stretch {
121 UltraCondensed = 50,
122 ExtraCondensed = 62,
123 Condensed = 75,
124 SemiCondensed = 87,
125 Unstretched = 100,
126 SemiExpanded = 112,
127 Expanded = 125,
128 ExtraExpanded = 150,
129 UltraExpanded = 200
130 };
131
132 // default font
133 QFont();
134 // specific font
135#ifdef Q_QDOC
136 QFont( const QString &amp;family, int pointSize = 12, int weight = Normal,
137 bool italic = FALSE );
138#else
139 QFont( const QString &amp;family, int pointSize = -1, int weight = -1,
140 bool italic = FALSE );
141#endif
142 // copy constructor
143 QFont( const QFont &amp; );
144
145 ~QFont();
146
147 QString family() const;
148 void setFamily( const QString &amp;);
149
150 int pointSize() const;
151 float pointSizeFloat() const;
152 void setPointSize( int );
153 void setPointSizeFloat( float );
154
155 int pixelSize() const;
156 void setPixelSize( int );
157 void setPixelSizeFloat( float );
158
159 int weight() const;
160 void setWeight( int );
161
162 bool bold() const;
163 void setBold( bool );
164
165 bool italic() const;
166 void setItalic( bool );
167
168 bool underline() const;
169 void setUnderline( bool );
170
171 bool overline() const;
172 void setOverline( bool );
173
174 bool strikeOut() const;
175 void setStrikeOut( bool );
176
177 bool fixedPitch() const;
178 void setFixedPitch( bool );
179
180 StyleHint styleHint() const;
181 StyleStrategy styleStrategy() const;
182 void setStyleHint( StyleHint, StyleStrategy = PreferDefault );
183 void setStyleStrategy( StyleStrategy s );
184
185 int stretch() const;
186 void setStretch( int );
187
188 // is raw mode still needed?
189 bool rawMode() const;
190 void setRawMode( bool );
191
192 // dupicated from QFontInfo
193 bool exactMatch() const;
194
195 QFont &amp;operator=( const QFont &amp; );
196 bool operator==( const QFont &amp; ) const;
197 bool operator!=( const QFont &amp; ) const;
198 bool isCopyOf( const QFont &amp; ) const;
199
200
201#ifdef Q_WS_WIN
202 HFONT handle() const;
203#else // !Q_WS_WIN
204 Qt::HANDLE handle() const;
205#endif // Q_WS_WIN
206
207
208 // needed for X11
209 void setRawName( const QString &amp; );
210 QString rawName() const;
211
212 QString key() const;
213
214 QString toString() const;
215 bool fromString(const QString &amp;);
216
217#ifndef QT_NO_STRINGLIST
218 static QString substitute(const QString &amp;);
219 static QStringList substitutes(const QString &amp;);
220 static QStringList substitutions();
221 static void insertSubstitution(const QString&amp;, const QString &amp;);
222 static void insertSubstitutions(const QString&amp;, const QStringList &amp;);
223 static void removeSubstitution(const QString &amp;);
224#endif //QT_NO_STRINGLIST
225 static void initialize();
226 static void cleanup();
227#ifndef Q_WS_QWS
228 static void cacheStatistics();
229#endif
230
231#if defined(Q_WS_QWS)
232 void qwsRenderToDisk(bool all=TRUE);
233#endif
234
235
236 // a copy of this lives in qunicodetables.cpp, as we can't include
237 // qfont.h it in tools/. Do not modify without changing the script
238 // enum in qunicodetable_p.h aswell.
239 enum Script {
240 // European Alphabetic Scripts
241 Latin,
242 Greek,
243 Cyrillic,
244 Armenian,
245 Georgian,
246 Runic,
247 Ogham,
248 SpacingModifiers,
249 CombiningMarks,
250
251 // Middle Eastern Scripts
252 Hebrew,
253 Arabic,
254 Syriac,
255 Thaana,
256
257 // South and Southeast Asian Scripts
258 Devanagari,
259 Bengali,
260 Gurmukhi,
261 Gujarati,
262 Oriya,
263 Tamil,
264 Telugu,
265 Kannada,
266 Malayalam,
267 Sinhala,
268 Thai,
269 Lao,
270 Tibetan,
271 Myanmar,
272 Khmer,
273
274 // East Asian Scripts
275 Han,
276 Hiragana,
277 Katakana,
278 Hangul,
279 Bopomofo,
280 Yi,
281
282 // Additional Scripts
283 Ethiopic,
284 Cherokee,
285 CanadianAboriginal,
286 Mongolian,
287
288 // Symbols
289 CurrencySymbols,
290 LetterlikeSymbols,
291 NumberForms,
292 MathematicalOperators,
293 TechnicalSymbols,
294 GeometricSymbols,
295 MiscellaneousSymbols,
296 EnclosedAndSquare,
297 Braille,
298
299 Unicode,
300
301 // some scripts added in Unicode 3.2
302 Tagalog,
303 Hanunoo,
304 Buhid,
305 Tagbanwa,
306
307 KatakanaHalfWidth,
308
309 // from Unicode 4.0
310 Limbu,
311 TaiLe,
312
313 // End
314#if !defined(Q_QDOC)
315 NScripts,
316 UnknownScript = NScripts,
317
318 NoScript,
319
320 // ----------------------------------------
321 // Dear User, you can see values &gt; NScript,
322 // but they are internal - do not touch.
323
324 Han_Japanese,
325 Han_SimplifiedChinese,
326 Han_TraditionalChinese,
327 Han_Korean,
328
329 LastPrivateScript
330#endif
331 };
332
333 QString defaultFamily() const;
334 QString lastResortFamily() const;
335 QString lastResortFont() const;
336
337#ifndef QT_NO_COMPAT
338
339 static QFont defaultFont();
340 static void setDefaultFont( const QFont &amp; );
341
342#endif // QT_NO_COMPAT
343
344 QFont resolve( const QFont &amp; ) const;
345
346protected:
347 // why protected?
348 bool dirty() const;
349 int deciPointSize() const;
350
351private:
352 QFont( QFontPrivate *, QPaintDevice *pd );
353
354 void detach();
355
356#if defined(Q_WS_MAC)
357 void macSetFont(QPaintDevice *);
358#elif defined(Q_WS_X11)
359 void x11SetScreen( int screen = -1 );
360 int x11Screen() const;
361#endif
362
363 friend class QFontMetrics;
364 friend class QFontInfo;
365 friend class QPainter;
366 friend class QPSPrinterFont;
367 friend class QApplication;
368 friend class QWidget;
369 friend class QTextFormatCollection;
370 friend class QTextLayout;
371 friend class QTextItem;
372 friend class QGLContext;
373#if defined(Q_WS_X11) &amp;&amp; !defined(QT_NO_XFTFREETYPE)
374 friend Qt::HANDLE qt_xft_handle(const QFont &amp;font);
375#endif
376#ifndef QT_NO_DATASTREAM
377 friend Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QFont &amp; );
378 friend Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QFont &amp; );
379#endif
380
381 QFontPrivate *d;
382};
383
384
385inline bool QFont::bold() const
386{ return weight() &gt; Normal; }
387
388
389inline void QFont::setBold( bool enable )
390{ setWeight( enable ? Bold : Normal ); }
391
392
393
394
395/*****************************************************************************
396 QFont stream functions
397 *****************************************************************************/
398
399#ifndef QT_NO_DATASTREAM
400Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QFont &amp; );
401Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QFont &amp; );
402#endif
403
404
405#endif // QFONT_H
406</pre>
407<!-- eof -->
408<p><address><hr><div align=center>
409<table width=100% cellspacing=0 border=0><tr>
410<td>Copyright &copy; 2007
411<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
412<td align=right><div align=right>Qt 3.3.8</div>
413</table></div></address></body>
414</html>
Note: See TracBrowser for help on using the repository browser.