source: trunk/include/qfontdatabase.h@ 7

Last change on this file since 7 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1/****************************************************************************
2** $Id: qfontdatabase.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of the QFontDatabase class
5**
6** Created : 981126
7**
8** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QFONTDATABASE_H
39#define QFONTDATABASE_H
40
41#ifndef QT_H
42#include "qwindowdefs.h"
43#include "qstring.h"
44#include "qstringlist.h"
45#include "qfont.h"
46#include "qvaluelist.h"
47#endif // QT_H
48
49
50#ifndef QT_NO_FONTDATABASE
51
52class QFontStylePrivate; /* Don't touch! */
53struct QtFontStyle;
54struct QtFontFamily;
55struct QtFontFoundry;
56struct QFontDef;
57class QFontEngine;
58#ifdef Q_WS_QWS
59class QDiskFont;
60#endif
61
62class QFontDatabasePrivate;
63
64class Q_EXPORT QFontDatabase
65{
66public:
67 static QValueList<int> standardSizes();
68
69 QFontDatabase();
70
71 QStringList families() const;
72 QStringList families( QFont::Script ) const;
73 QStringList styles( const QString & ) const;
74 QValueList<int> pointSizes( const QString &, const QString & = QString::null);
75 QValueList<int> smoothSizes( const QString &, const QString &);
76 QString styleString( const QFont &);
77
78 QFont font( const QString &, const QString &, int);
79
80 bool isBitmapScalable( const QString &, const QString & = QString::null) const;
81 bool isSmoothlyScalable( const QString &, const QString & = QString::null) const;
82 bool isScalable( const QString &, const QString & = QString::null) const;
83 bool isFixedPitch( const QString &, const QString & = QString::null) const;
84
85 bool italic( const QString &, const QString &) const;
86 bool bold( const QString &, const QString &) const;
87 int weight( const QString &, const QString &) const;
88
89 static QString scriptName(QFont::Script);
90 static QString scriptSample(QFont::Script);
91
92#ifdef Q_WS_QWS
93 static void qwsAddDiskFont( QDiskFont *qdf );
94#endif
95
96 // For source compatibility with < 3.0
97#ifndef QT_NO_COMPAT
98
99 QStringList families(bool) const;
100 QStringList styles( const QString &, const QString & ) const;
101 QValueList<int> pointSizes( const QString &, const QString &, const QString & );
102 QValueList<int> smoothSizes( const QString &, const QString &, const QString & );
103
104 QFont font( const QString &, const QString &, int, const QString &);
105
106 bool isBitmapScalable( const QString &, const QString &, const QString & ) const;
107 bool isSmoothlyScalable( const QString &, const QString &, const QString & ) const;
108 bool isScalable( const QString &, const QString &, const QString & ) const;
109 bool isFixedPitch( const QString &, const QString &, const QString & ) const;
110
111 bool italic( const QString &, const QString &, const QString & ) const;
112 bool bold( const QString &, const QString &, const QString & ) const;
113 int weight( const QString &, const QString &, const QString & ) const;
114
115#endif // QT_NO_COMPAT
116
117private:
118#if defined(Q_WS_X11) || defined(Q_WS_WIN)
119 static QFontEngine *findFont( QFont::Script script, const QFontPrivate *fp,
120 const QFontDef &request, int force_encoding_id = -1 );
121#endif // Q_WS_X11
122
123 static void createDatabase();
124
125 static void parseFontName(const QString &name, QString &foundry, QString &family);
126
127 friend struct QFontDef;
128 friend class QFontPrivate;
129 friend class QFontDialog;
130 friend class QFontEngineLatinXLFD;
131
132 QFontDatabasePrivate *d;
133};
134
135
136#ifndef QT_NO_COMPAT
137
138inline QStringList QFontDatabase::families( bool ) const
139{
140 return families();
141}
142
143inline QStringList QFontDatabase::styles( const QString &family,
144 const QString & ) const
145{
146 return styles(family);
147}
148
149inline QValueList<int> QFontDatabase::pointSizes( const QString &family,
150 const QString &style ,
151 const QString & )
152{
153 return pointSizes(family, style);
154}
155
156inline QValueList<int> QFontDatabase::smoothSizes( const QString &family,
157 const QString &style,
158 const QString & )
159{
160 return smoothSizes(family, style);
161}
162
163inline QFont QFontDatabase::font( const QString &familyName,
164 const QString &style,
165 int pointSize,
166 const QString &)
167{
168 return font(familyName, style, pointSize);
169}
170
171inline bool QFontDatabase::isBitmapScalable( const QString &family,
172 const QString &style,
173 const QString & ) const
174{
175 return isBitmapScalable(family, style);
176}
177
178inline bool QFontDatabase::isSmoothlyScalable( const QString &family,
179 const QString &style,
180 const QString & ) const
181{
182 return isSmoothlyScalable(family, style);
183}
184
185inline bool QFontDatabase::isScalable( const QString &family,
186 const QString &style,
187 const QString & ) const
188{
189 return isScalable(family, style);
190}
191
192inline bool QFontDatabase::isFixedPitch( const QString &family,
193 const QString &style,
194 const QString & ) const
195{
196 return isFixedPitch(family, style);
197}
198
199inline bool QFontDatabase::italic( const QString &family,
200 const QString &style,
201 const QString & ) const
202{
203 return italic(family, style);
204}
205
206inline bool QFontDatabase::bold( const QString &family,
207 const QString &style,
208 const QString & ) const
209{
210 return bold(family, style);
211}
212
213inline int QFontDatabase::weight( const QString &family,
214 const QString &style,
215 const QString & ) const
216{
217 return weight(family, style);
218}
219
220#endif // QT_NO_COMPAT
221
222#endif // QT_NO_FONTDATABASE
223
224#endif // QFONTDATABASE_H
Note: See TracBrowser for help on using the repository browser.