54 // |
54 // |
55 |
55 |
56 #include "QtCore/qglobal.h" |
56 #include "QtCore/qglobal.h" |
57 #include "QtCore/qatomic.h" |
57 #include "QtCore/qatomic.h" |
58 #include <QtCore/qvarlengtharray.h> |
58 #include <QtCore/qvarlengtharray.h> |
|
59 #include <QtCore/QLinkedList> |
59 #include "private/qtextengine_p.h" |
60 #include "private/qtextengine_p.h" |
60 #include "private/qfont_p.h" |
61 #include "private/qfont_p.h" |
61 |
62 |
62 #ifdef Q_WS_WIN |
63 #ifdef Q_WS_WIN |
63 # include "QtCore/qt_windows.h" |
64 # include "QtCore/qt_windows.h" |
217 HB_Face harfbuzzFace() const; |
218 HB_Face harfbuzzFace() const; |
218 |
219 |
219 virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); |
220 virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); |
220 |
221 |
221 void setGlyphCache(void *key, QFontEngineGlyphCache *data); |
222 void setGlyphCache(void *key, QFontEngineGlyphCache *data); |
222 void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data); |
223 QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const; |
223 QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const; |
|
224 QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const; |
|
225 |
224 |
226 static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); |
225 static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); |
227 static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode); |
226 static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode); |
228 |
227 |
229 QAtomicInt ref; |
228 QAtomicInt ref; |
252 |
251 |
253 protected: |
252 protected: |
254 static const QVector<QRgb> &grayPalette(); |
253 static const QVector<QRgb> &grayPalette(); |
255 |
254 |
256 private: |
255 private: |
257 /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones. |
256 struct GlyphCacheEntry { |
258 void expireGlyphCache(); |
257 void *context; |
259 |
258 QFontEngineGlyphCache *cache; |
260 GlyphPointerHash m_glyphPointerHash; |
259 bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; } |
261 GlyphIntHash m_glyphIntHash; |
260 }; |
262 mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue; |
261 |
|
262 mutable QLinkedList<GlyphCacheEntry> m_glyphCaches; |
263 }; |
263 }; |
264 |
264 |
265 inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2) |
265 inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2) |
266 { |
266 { |
267 return (f1.index == f2.index) && (f1.encoding == f2.encoding) && (f1.filename == f2.filename); |
267 return (f1.index == f2.index) && (f1.encoding == f2.encoding) && (f1.filename == f2.filename); |