File: qfont-h.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (292 lines) | stat: -rw-r--r-- 10,475 bytes parent folder | download
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
Qt Toolkit - qfont.h include file
</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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>qfont.h</h1><br clear="all">
This is the verbatim text of the qfont.h include file.  It is
provided only for illustration; the copyright
remains with Trolltech.
<hr>
<pre>
/****************************************************************************
** &#36;Id&#58; qt/src/kernel/qfont.h   2.3.2   edited 2001-04-19 $
**
** Definition of QFont class
**
** Created : 940514
**
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
**   information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#ifndef QFONT_H
#define QFONT_H

#ifndef QT_H
#include "qwindowdefs.h"
#include "qstring.h"
#endif // QT_H


class <a href="qstringlist.html">QStringList</a>;
struct QFontDef;
struct QFontData;
class QFontInternal;
class QRenderedFont;

class Q_EXPORT <a href="qfont.html">QFont</a>                                    // font class
{
public:
    enum CharSet   { ISO_8859_1,  Latin1 = ISO_8859_1, AnyCharSet,
                     ISO_8859_2,  Latin2 = ISO_8859_2,
                     ISO_8859_3,  Latin3 = ISO_8859_3,
                     ISO_8859_4,  Latin4 = ISO_8859_4,
                     ISO_8859_5,
                     ISO_8859_6,
                     ISO_8859_7,
                     ISO_8859_8,
                     ISO_8859_9,  Latin5 = ISO_8859_9,
                     ISO_8859_10, Latin6 = ISO_8859_10,
                     ISO_8859_11, TIS620 = ISO_8859_11,
                     ISO_8859_12,
                     ISO_8859_13, Latin7 = ISO_8859_13,
                     ISO_8859_14, Latin8 = ISO_8859_14,
                     ISO_8859_15, Latin9 = ISO_8859_15,
                     KOI8R,
                     Set_Ja, Set_1 = Set_Ja,
                     Set_Ko,
                     Set_Th_TH,
                     Set_Zh,
                     Set_Zh_TW,
                     Set_N = Set_Zh_TW,
                     Unicode,
                     /* The following will need to be re-ordered later,
                        since we accidentally left no room below "Unicode".
                        (For binary-compatibility that cannot change yet).
                        The above will be obsoleted and a same-named list
                        added below.
                     */
                     Set_GBK,
                     Set_Big5,

                     TSCII,
                     KOI8U,
                     CP1251,
                     PT154,
                     /* The following are font-specific encodings that
                        we shouldn't need in a perfect world.
                     */
                     // 8-bit fonts
                     JIS_X_0201 = 0xa0,
                     // 16-bit fonts
                     JIS_X_0208 = 0xc0, Enc16 = JIS_X_0208,
                     KSC_5601,
                     GB_2312,
                     Big5
    };
    enum StyleHint { Helvetica, Times, Courier, OldEnglish,  System, AnyStyle,
                     SansSerif  = Helvetica,
                     Serif      = Times,
                     TypeWriter = Courier,
                     Decorative = OldEnglish};
    enum StyleStrategy { PreferDefault = 0x0001,
                          PreferBitmap = 0x0002,
                          PreferDevice = 0x0004,
                          PreferOutline = 0x0008,
                          ForceOutline = 0x0010,
                          PreferMatch = 0x0020,
                          PreferQuality = 0x0040 };
    enum Weight    { Light = 25, Normal = 50, DemiBold = 63,
                     Bold  = 75, Black  = 87 };
    QFont();                                    // default font
    QFont( const QString &amp;family, int pointSize = 12,
           int weight = Normal, bool italic = FALSE );
    QFont( const QString &amp;family, int pointSize,
           int weight, bool italic, CharSet charSet );
    QFont( const QFont &amp; );
    ~QFont();
    QFont      &amp;operator=( const QFont &amp; );

    QString     family()        const;
    void        setFamily( const QString &amp;);
    int         pointSize()     const;
    float       pointSizeFloat()        const;
    void        setPointSize( int );
    void        setPointSizeFloat( float );
    int         pixelSize() const;
    void        setPixelSize( int );
    void        setPixelSizeFloat( float );
    int         weight()        const;
    void        setWeight( int );
    bool        bold()          const;
    void        setBold( bool );
    bool        italic()        const;
    void        setItalic( bool );
    bool        underline()     const;
    void        setUnderline( bool );
    bool        strikeOut()     const;
    void        setStrikeOut( bool );
    bool        fixedPitch()    const;
    void        setFixedPitch( bool );
    StyleHint   styleHint()     const;
    void        setStyleHint( StyleHint );
    StyleStrategy styleStrategy() const;
    void        setStyleHint( StyleHint, StyleStrategy );
    CharSet     charSet()       const;
    void        setCharSet( CharSet );

    static CharSet charSetForLocale();

    bool        rawMode()      const;
    void        setRawMode( bool );

    bool        exactMatch()    const;

    bool        operator==( const QFont &amp; ) const;
    bool        operator!=( const QFont &amp; ) const;
    bool        isCopyOf( const QFont &amp; ) const;

#if defined(_WS_WIN_)
    HFONT       handle() const;
#elif defined(_WS_MAC_)
    HANDLE      handle() const;
#elif defined(_WS_X11_)
    HANDLE      handle() const;
#elif defined(_WS_QWS_)
    HANDLE      handle() const;
#endif

    void        setRawName( const QString &amp; );
    QString     rawName() const;

    QString     key() const;

    static QString encodingName( CharSet );

    static QFont defaultFont();
    static void setDefaultFont( const QFont &amp; );

    static QString substitute( const QString &amp;familyName );
    static void insertSubstitution( const QString&amp;, const QString &amp;);
    static void removeSubstitution( const QString &amp;);
    static QStringList substitutions();

    static void initialize();
    static void locale_init();
    static void cleanup();
    static void cacheStatistics();

#if defined(_WS_QWS_)
    void qwsRenderToDisk(bool all=TRUE);
#endif

protected:
    bool        dirty()                 const;

    QString     defaultFamily()         const;
    QString     lastResortFamily()      const;
    QString     lastResortFont()        const;
    int         deciPointSize()         const;

private:
    QFont( QFontData * );
    void        init();
    void        detach();
    void        initFontInfo() const;
    void        load() const;
#if defined(_WS_MAC_)
    void        macSetFont(void *);
#endif
#if defined(_WS_WIN_)
    HFONT       create( bool *, HDC=0, bool=FALSE ) const;
    void       *textMetric() const;
#endif

    friend class QFont_Private;
    friend class QFontInternal;
    friend class QFontMetrics;
    friend class QFontInfo;
    friend class QPainter;
#if defined(_WS_X11_) &amp;&amp; defined(QT_XFT)
    friend void * qt_ft_font (const QFont *f);
#endif

#ifndef QT_NO_DATASTREAM
    friend Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QFont &amp; );
    friend Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QFont &amp; );
#endif
    QFontData    *d;                            // internal font data
    static CharSet defaultCharSet;
};

inline bool QFont::bold() const
{ return weight() &gt; Normal; }

inline void QFont::setBold( bool enable )
{ setWeight( enable ? Bold : Normal ); }


/*****************************************************************************
  QFont stream functions
 *****************************************************************************/

#ifndef QT_NO_DATASTREAM
Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QFont &amp; );
Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QFont &amp; );
#endif

#endif // QFONT_H

</pre>
<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>