Diffstat (limited to 'qmake/include/private/qfontdata_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/include/private/qfontdata_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qmake/include/private/qfontdata_p.h b/qmake/include/private/qfontdata_p.h index 917d14f..1eaf80c 100644 --- a/qmake/include/private/qfontdata_p.h +++ b/qmake/include/private/qfontdata_p.h | |||
@@ -117,96 +117,97 @@ public: | |||
117 | { ; } | 117 | { ; } |
118 | 118 | ||
119 | ~QFontStruct(); | 119 | ~QFontStruct(); |
120 | 120 | ||
121 | Qt::HANDLE handle, xfthandle, xftpattern; | 121 | Qt::HANDLE handle, xfthandle, xftpattern; |
122 | QCString name; | 122 | QCString name; |
123 | QTextCodec *codec; | 123 | QTextCodec *codec; |
124 | int cache_cost; | 124 | int cache_cost; |
125 | float scale; // needed for printing, to correctly scale font metrics for bitmap fonts | 125 | float scale; // needed for printing, to correctly scale font metrics for bitmap fonts |
126 | }; | 126 | }; |
127 | 127 | ||
128 | enum { widthCacheSize = 0x500 }; | 128 | enum { widthCacheSize = 0x500 }; |
129 | 129 | ||
130 | class QFontX11Data // used as a QFontPrivate member | 130 | class QFontX11Data // used as a QFontPrivate member |
131 | { | 131 | { |
132 | public: | 132 | public: |
133 | // X fontstruct handles for each character set | 133 | // X fontstruct handles for each character set |
134 | QFontStruct *fontstruct[QFont::LastPrivateScript]; | 134 | QFontStruct *fontstruct[QFont::LastPrivateScript]; |
135 | 135 | ||
136 | uchar widthCache[widthCacheSize]; | 136 | uchar widthCache[widthCacheSize]; |
137 | 137 | ||
138 | QFontX11Data(); | 138 | QFontX11Data(); |
139 | ~QFontX11Data(); | 139 | ~QFontX11Data(); |
140 | }; | 140 | }; |
141 | 141 | ||
142 | #endif // Q_WS_X11 | 142 | #endif // Q_WS_X11 |
143 | 143 | ||
144 | 144 | ||
145 | #ifdef Q_WS_WIN | 145 | #ifdef Q_WS_WIN |
146 | 146 | ||
147 | class QFontStruct : public QShared | 147 | class QFontStruct : public QShared |
148 | { | 148 | { |
149 | public: | 149 | public: |
150 | QFontStruct( const QString &key ); | 150 | QFontStruct( const QString &key ); |
151 | ~QFontStruct() { reset(); } | 151 | ~QFontStruct() { reset(); } |
152 | bool dirty() const { return hfont == 0; } | 152 | bool dirty() const { return hfont == 0; } |
153 | HDC dc() const; | 153 | HDC dc() const; |
154 | HFONT font() const { return hfont; } | 154 | HFONT font() const { return hfont; } |
155 | const TEXTMETRICA *textMetricA() const { return &tm.a; } | 155 | const TEXTMETRICA *textMetricA() const { return &tm.a; } |
156 | const TEXTMETRICW *textMetricW() const { return &tm.w; } | 156 | const TEXTMETRICW *textMetricW() const { return &tm.w; } |
157 | QString key() const { return k; } | 157 | QString key() const { return k; } |
158 | void reset(); | 158 | void reset(); |
159 | 159 | ||
160 | QStringk; | 160 | QStringk; |
161 | HDC hdc; | 161 | HDC hdc; |
162 | HFONThfont; | 162 | HFONThfont; |
163 | uintstockFont:1; | 163 | uintstockFont:1; |
164 | uintpaintDevice:1; | 164 | uintpaintDevice:1; |
165 | uint useTextOutA:1; | ||
165 | union { | 166 | union { |
166 | TEXTMETRICWw; | 167 | TEXTMETRICWw; |
167 | TEXTMETRICAa; | 168 | TEXTMETRICAa; |
168 | } tm; | 169 | } tm; |
169 | int lw; | 170 | int lw; |
170 | int cache_cost; | 171 | int cache_cost; |
171 | // friend void QFont::initFontInfo() const; | 172 | // friend void QFont::initFontInfo() const; |
172 | }; | 173 | }; |
173 | 174 | ||
174 | #endif // Q_WS_WIN | 175 | #endif // Q_WS_WIN |
175 | 176 | ||
176 | #if defined( Q_WS_MAC ) | 177 | #if defined( Q_WS_MAC ) |
177 | 178 | ||
178 | #if defined( Q_WS_MACX ) | 179 | #if defined( Q_WS_MACX ) |
179 | # define QMAC_FONT_ATSUI | 180 | # define QMAC_FONT_ATSUI |
180 | #endif | 181 | #endif |
181 | #include "qt_mac.h" | 182 | #include "qt_mac.h" |
182 | class QMacFontInfo; | 183 | class QMacFontInfo; |
183 | 184 | ||
184 | class QFontStruct : public QShared | 185 | class QFontStruct : public QShared |
185 | { | 186 | { |
186 | public: | 187 | public: |
187 | inline QFontStruct() : QShared(), info(NULL), fnum(-1), cache_cost(0), internal_fi(NULL) { } | 188 | inline QFontStruct() : QShared(), info(NULL), fnum(-1), cache_cost(0), internal_fi(NULL) { } |
188 | #if defined( QMAC_FONT_ATSUI ) && 0 | 189 | #if defined( QMAC_FONT_ATSUI ) && 0 |
189 | ATSFontMetrics *info; | 190 | ATSFontMetrics *info; |
190 | int maxWidth() const { return (int)info->maxAdvanceWidth; } | 191 | int maxWidth() const { return (int)info->maxAdvanceWidth; } |
191 | #else | 192 | #else |
192 | FontInfo *info; | 193 | FontInfo *info; |
193 | int maxWidth() const { return info->widMax; } | 194 | int maxWidth() const { return info->widMax; } |
194 | #endif | 195 | #endif |
195 | int ascent() const { return (int)info->ascent; } | 196 | int ascent() const { return (int)info->ascent; } |
196 | int descent() const { return (int)info->descent; } | 197 | int descent() const { return (int)info->descent; } |
197 | int leading() const { return (int)info->leading; } | 198 | int leading() const { return (int)info->leading; } |
198 | int minLeftBearing() const { return 0; } | 199 | int minLeftBearing() const { return 0; } |
199 | int minRightBearing() const { return 0; } | 200 | int minRightBearing() const { return 0; } |
200 | 201 | ||
201 | short fnum; | 202 | short fnum; |
202 | int psize, cache_cost; | 203 | int psize, cache_cost; |
203 | QMacFontInfo *internal_fi; | 204 | QMacFontInfo *internal_fi; |
204 | }; | 205 | }; |
205 | 206 | ||
206 | #endif | 207 | #endif |
207 | 208 | ||
208 | #ifdef Q_WS_QWS | 209 | #ifdef Q_WS_QWS |
209 | class QFontStruct; | 210 | class QFontStruct; |
210 | class QGfx; | 211 | class QGfx; |
211 | #endif | 212 | #endif |
212 | 213 | ||
@@ -368,97 +369,97 @@ public: | |||
368 | #ifndef QT_NO_XFTFREETYPE | 369 | #ifndef QT_NO_XFTFREETYPE |
369 | XftPattern *findXftFont(const QChar &, bool *, double *scale) const; | 370 | XftPattern *findXftFont(const QChar &, bool *, double *scale) const; |
370 | XftPattern *bestXftPattern(const QString &, const QString &, const QChar &, double *scale) const; | 371 | XftPattern *bestXftPattern(const QString &, const QString &, const QChar &, double *scale) const; |
371 | #endif // QT_NO_XFTFREETYPE | 372 | #endif // QT_NO_XFTFREETYPE |
372 | QCString findFont(QFont::Script, bool *, double *) const; | 373 | QCString findFont(QFont::Script, bool *, double *) const; |
373 | QCString bestFamilyMember(QFont::Script, const QString &, const QString &, | 374 | QCString bestFamilyMember(QFont::Script, const QString &, const QString &, |
374 | const QString &, int *, double *) const; | 375 | const QString &, int *, double *) const; |
375 | QCString bestMatch(const char *, int *, QFont::Script, double *) const; | 376 | QCString bestMatch(const char *, int *, QFont::Script, double *) const; |
376 | int fontMatchScore(const char *, QCString &, float *, int *, bool *, | 377 | int fontMatchScore(const char *, QCString &, float *, int *, bool *, |
377 | bool *, QFont::Script, double *) const; | 378 | bool *, QFont::Script, double *) const; |
378 | void initFontInfo(QFont::Script, double scale); | 379 | void initFontInfo(QFont::Script, double scale); |
379 | void load(QFont::Script = QFont::NoScript, bool = TRUE); | 380 | void load(QFont::Script = QFont::NoScript, bool = TRUE); |
380 | bool loadUnicode(QFont::Script, const QChar &); | 381 | bool loadUnicode(QFont::Script, const QChar &); |
381 | void computeLineWidth(); | 382 | void computeLineWidth(); |
382 | 383 | ||
383 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); | 384 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); |
384 | void textExtents( const QString &str, int pos, int len, QCharStruct *overall ); | 385 | void textExtents( const QString &str, int pos, int len, QCharStruct *overall ); |
385 | void drawText( Display *dpy, int screen, Qt::HANDLE hd, Qt::HANDLE rendhd, | 386 | void drawText( Display *dpy, int screen, Qt::HANDLE hd, Qt::HANDLE rendhd, |
386 | GC gc, const QColor &pen, Qt::BGMode, const QColor &bgcolor, | 387 | GC gc, const QColor &pen, Qt::BGMode, const QColor &bgcolor, |
387 | int x, int y, const TextRun *cache, int pdWidth ); | 388 | int x, int y, const TextRun *cache, int pdWidth ); |
388 | bool inFont( const QChar &ch ); | 389 | bool inFont( const QChar &ch ); |
389 | 390 | ||
390 | QFontX11Data x11data; | 391 | QFontX11Data x11data; |
391 | static QFont::Script defaultScript; | 392 | static QFont::Script defaultScript; |
392 | int x11Screen; | 393 | int x11Screen; |
393 | #endif // Q_WS_X11 | 394 | #endif // Q_WS_X11 |
394 | 395 | ||
395 | QPaintDevice *paintdevice; | 396 | QPaintDevice *paintdevice; |
396 | 397 | ||
397 | #ifdef Q_WS_WIN | 398 | #ifdef Q_WS_WIN |
398 | void load(); | 399 | void load(); |
399 | void initFontInfo(); | 400 | void initFontInfo(); |
400 | HFONT create( bool *stockFont, HDC hdc = 0, bool compatMode = FALSE ); | 401 | HFONT create( bool *stockFont, HDC hdc = 0, bool compatMode = FALSE ); |
401 | QFontStruct *fin; | 402 | QFontStruct *fin; |
402 | 403 | ||
403 | void buildCache( HDC hdc, const QString &str, int pos, int len, TextRun *cache ); | 404 | void buildCache( HDC hdc, const QString &str, int pos, int len, TextRun *cache ); |
404 | void drawText( HDC hdc, int x, int y, TextRun *cache ); | 405 | void drawText( HDC hdc, int x, int y, TextRun *cache ); |
405 | #endif // Q_WS_WIN | 406 | #endif // Q_WS_WIN |
406 | 407 | ||
407 | #ifdef Q_WS_QWS | 408 | #ifdef Q_WS_QWS |
408 | void load(); | 409 | void load(); |
409 | QFontStruct *fin; | 410 | QFontStruct *fin; |
410 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); | 411 | int textWidth( const QString &str, int pos, int len, TextRun *cache ); |
411 | void drawText( QGfx *gfx, int x, int y, const TextRun *cache ); | 412 | void drawText( QGfx *gfx, int x, int y, const TextRun *cache ); |
412 | #endif | 413 | #endif |
413 | 414 | ||
414 | #if defined( Q_WS_MAC ) | 415 | #if defined( Q_WS_MAC ) |
415 | void macSetFont(QPaintDevice *); | 416 | void macSetFont(QPaintDevice *); |
416 | void drawText(int x, int y, QString s, int len, QPaintDevice *dev, const QRegion *rgn); | 417 | void drawText(int x, int y, const QString &s, int from, int len, QPaintDevice *dev, const QRegion *rgn, int dir); |
417 | void computeLineWidth(); | 418 | void computeLineWidth(); |
418 | void load(); | 419 | void load(); |
419 | QFontStruct *fin; | 420 | QFontStruct *fin; |
420 | #endif | 421 | #endif |
421 | 422 | ||
422 | }; | 423 | }; |
423 | 424 | ||
424 | inline QFontPrivate::QFontPrivate() | 425 | inline QFontPrivate::QFontPrivate() |
425 | : QShared(), exactMatch(FALSE), lineWidth(1) | 426 | : QShared(), exactMatch(FALSE), lineWidth(1) |
426 | { | 427 | { |
427 | 428 | ||
428 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) | 429 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) |
429 | fin = 0; | 430 | fin = 0; |
430 | #endif // Q_WS_WIN || Q_WS_QWS | 431 | #endif // Q_WS_WIN || Q_WS_QWS |
431 | #if defined(Q_WS_X11) | 432 | #if defined(Q_WS_X11) |
432 | x11Screen = QPaintDevice::x11AppScreen(); | 433 | x11Screen = QPaintDevice::x11AppScreen(); |
433 | #endif // Q_WS_X11 | 434 | #endif // Q_WS_X11 |
434 | paintdevice = 0; | 435 | paintdevice = 0; |
435 | } | 436 | } |
436 | 437 | ||
437 | inline QFontPrivate::QFontPrivate(const QFontPrivate &fp) | 438 | inline QFontPrivate::QFontPrivate(const QFontPrivate &fp) |
438 | : QShared(), request(fp.request), actual(fp.actual), | 439 | : QShared(), request(fp.request), actual(fp.actual), |
439 | exactMatch(fp.exactMatch), lineWidth(1) | 440 | exactMatch(fp.exactMatch), lineWidth(1) |
440 | { | 441 | { |
441 | Q_ASSERT(!fp.paintdevice); | 442 | Q_ASSERT(!fp.paintdevice); |
442 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) | 443 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) |
443 | fin = 0; | 444 | fin = 0; |
444 | #endif // Q_WS_WIN || Q_WS_QWS | 445 | #endif // Q_WS_WIN || Q_WS_QWS |
445 | #if defined(Q_WS_X11) | 446 | #if defined(Q_WS_X11) |
446 | x11Screen = fp.x11Screen; | 447 | x11Screen = fp.x11Screen; |
447 | #endif // Q_WS_X11 | 448 | #endif // Q_WS_X11 |
448 | paintdevice = 0; | 449 | paintdevice = 0; |
449 | } | 450 | } |
450 | 451 | ||
451 | inline QFontPrivate::QFontPrivate( const QFontPrivate &fp, QPaintDevice *pd ) | 452 | inline QFontPrivate::QFontPrivate( const QFontPrivate &fp, QPaintDevice *pd ) |
452 | : QShared(), request(fp.request), actual(fp.actual), | 453 | : QShared(), request(fp.request), actual(fp.actual), |
453 | exactMatch(fp.exactMatch), lineWidth(1) | 454 | exactMatch(fp.exactMatch), lineWidth(1) |
454 | { | 455 | { |
455 | 456 | ||
456 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) | 457 | #if defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_MAC) |
457 | fin = 0; | 458 | fin = 0; |
458 | #endif // Q_WS_WIN || Q_WS_QWS | 459 | #endif // Q_WS_WIN || Q_WS_QWS |
459 | #if defined(Q_WS_X11) | 460 | #if defined(Q_WS_X11) |
460 | x11Screen = pd->x11Screen(); | 461 | x11Screen = pd->x11Screen(); |
461 | #endif // Q_WS_X11 | 462 | #endif // Q_WS_X11 |
462 | paintdevice = pd; | 463 | paintdevice = pd; |
463 | } | 464 | } |
464 | 465 | ||