[2] | 1 | /****************************************************************************
|
---|
| 2 | ** $Id: qfontdatabase.h 8 2005-11-16 19:36:46Z 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 |
|
---|
| 52 | class QFontStylePrivate; /* Don't touch! */
|
---|
| 53 | struct QtFontStyle;
|
---|
| 54 | struct QtFontFamily;
|
---|
| 55 | struct QtFontFoundry;
|
---|
| 56 | struct QFontDef;
|
---|
| 57 | class QFontEngine;
|
---|
| 58 | #ifdef Q_WS_QWS
|
---|
| 59 | class QDiskFont;
|
---|
| 60 | #endif
|
---|
| 61 |
|
---|
| 62 | class QFontDatabasePrivate;
|
---|
| 63 |
|
---|
| 64 | class Q_EXPORT QFontDatabase
|
---|
| 65 | {
|
---|
| 66 | public:
|
---|
| 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 |
|
---|
| 117 | private:
|
---|
[8] | 118 | #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_PM)
|
---|
[2] | 119 | static QFontEngine *findFont( QFont::Script script, const QFontPrivate *fp,
|
---|
| 120 | const QFontDef &request, int force_encoding_id = -1 );
|
---|
[8] | 121 | #endif // Q_WS_X11 || Q_WS_WIN || Q_WS_PM
|
---|
[2] | 122 |
|
---|
[8] | 123 | #ifdef Q_WS_PM
|
---|
| 124 | // a dummy method for compatibility with platform independent
|
---|
| 125 | // parts of QFontDatabase
|
---|
| 126 | static void load( const QString &/*family*/ = QString::null, int = -1 ) { }
|
---|
| 127 | #else
|
---|
[2] | 128 | static void createDatabase();
|
---|
[8] | 129 | #endif
|
---|
[2] | 130 |
|
---|
| 131 | static void parseFontName(const QString &name, QString &foundry, QString &family);
|
---|
| 132 |
|
---|
| 133 | friend struct QFontDef;
|
---|
| 134 | friend class QFontPrivate;
|
---|
| 135 | friend class QFontDialog;
|
---|
| 136 | friend class QFontEngineLatinXLFD;
|
---|
| 137 |
|
---|
| 138 | QFontDatabasePrivate *d;
|
---|
| 139 | };
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 | #ifndef QT_NO_COMPAT
|
---|
| 143 |
|
---|
| 144 | inline QStringList QFontDatabase::families( bool ) const
|
---|
| 145 | {
|
---|
| 146 | return families();
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | inline QStringList QFontDatabase::styles( const QString &family,
|
---|
| 150 | const QString & ) const
|
---|
| 151 | {
|
---|
| 152 | return styles(family);
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | inline QValueList<int> QFontDatabase::pointSizes( const QString &family,
|
---|
| 156 | const QString &style ,
|
---|
| 157 | const QString & )
|
---|
| 158 | {
|
---|
| 159 | return pointSizes(family, style);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | inline QValueList<int> QFontDatabase::smoothSizes( const QString &family,
|
---|
| 163 | const QString &style,
|
---|
| 164 | const QString & )
|
---|
| 165 | {
|
---|
| 166 | return smoothSizes(family, style);
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | inline QFont QFontDatabase::font( const QString &familyName,
|
---|
| 170 | const QString &style,
|
---|
| 171 | int pointSize,
|
---|
| 172 | const QString &)
|
---|
| 173 | {
|
---|
| 174 | return font(familyName, style, pointSize);
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | inline bool QFontDatabase::isBitmapScalable( const QString &family,
|
---|
| 178 | const QString &style,
|
---|
| 179 | const QString & ) const
|
---|
| 180 | {
|
---|
| 181 | return isBitmapScalable(family, style);
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | inline bool QFontDatabase::isSmoothlyScalable( const QString &family,
|
---|
| 185 | const QString &style,
|
---|
| 186 | const QString & ) const
|
---|
| 187 | {
|
---|
| 188 | return isSmoothlyScalable(family, style);
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | inline bool QFontDatabase::isScalable( const QString &family,
|
---|
| 192 | const QString &style,
|
---|
| 193 | const QString & ) const
|
---|
| 194 | {
|
---|
| 195 | return isScalable(family, style);
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | inline bool QFontDatabase::isFixedPitch( const QString &family,
|
---|
| 199 | const QString &style,
|
---|
| 200 | const QString & ) const
|
---|
| 201 | {
|
---|
| 202 | return isFixedPitch(family, style);
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | inline bool QFontDatabase::italic( const QString &family,
|
---|
| 206 | const QString &style,
|
---|
| 207 | const QString & ) const
|
---|
| 208 | {
|
---|
| 209 | return italic(family, style);
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | inline bool QFontDatabase::bold( const QString &family,
|
---|
| 213 | const QString &style,
|
---|
| 214 | const QString & ) const
|
---|
| 215 | {
|
---|
| 216 | return bold(family, style);
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | inline int QFontDatabase::weight( const QString &family,
|
---|
| 220 | const QString &style,
|
---|
| 221 | const QString & ) const
|
---|
| 222 | {
|
---|
| 223 | return weight(family, style);
|
---|
| 224 | }
|
---|
| 225 |
|
---|
| 226 | #endif // QT_NO_COMPAT
|
---|
| 227 |
|
---|
| 228 | #endif // QT_NO_FONTDATABASE
|
---|
| 229 |
|
---|
| 230 | #endif // QFONTDATABASE_H
|
---|