summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 7e04180e76..be346e9975 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -184,10 +184,6 @@ QFontEngine::QFontEngine()
QFontEngine::~QFontEngine()
{
- for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(),
- end = m_glyphCaches.constEnd(); it != end; ++it) {
- delete it->cache;
- }
m_glyphCaches.clear();
qHBFreeFace(hbFace);
}
@@ -241,6 +237,24 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
return metrics;
}
+QFont QFontEngine::createExplicitFont() const
+{
+ return createExplicitFontWithName(fontDef.family);
+}
+
+QFont QFontEngine::createExplicitFontWithName(const QString &familyName) const
+{
+ QFont font(familyName);
+ font.setStyleStrategy(QFont::NoFontMerging);
+ font.setWeight(fontDef.weight);
+ font.setItalic(fontDef.style == QFont::StyleItalic);
+ if (fontDef.pointSize < 0)
+ font.setPixelSize(fontDef.pixelSize);
+ else
+ font.setPointSizeF(fontDef.pointSize);
+ return font;
+}
+
QFixed QFontEngine::xHeight() const
{
QGlyphLayoutArray<8> glyphs;
@@ -601,7 +615,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
return i;
}
-QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const QTransform &t)
+QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, int /* margin */, const QTransform &t)
{
QImage alphaMask = alphaMapForGlyph(glyph, t);
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
@@ -711,14 +725,16 @@ void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
{
Q_ASSERT(data);
- GlyphCacheEntry entry = { key, data };
+ GlyphCacheEntry entry;
+ entry.context = key;
+ entry.cache = data;
if (m_glyphCaches.contains(entry))
return;
// Limit the glyph caches to 4. This covers all 90 degree rotations and limits
// memory use when there is continuous or random rotation
if (m_glyphCaches.size() == 4)
- delete m_glyphCaches.takeLast().cache;
+ m_glyphCaches.removeLast();
m_glyphCaches.push_front(entry);
@@ -727,7 +743,7 @@ void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
{
for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
- QFontEngineGlyphCache *c = it->cache;
+ QFontEngineGlyphCache *c = it->cache.data();
if (key == it->context
&& type == c->cacheType()
&& qtransform_equals_no_translate(c->m_transform, transform)) {