diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-04-27 12:21:54 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-04-27 14:36:38 (GMT) |
commit | f0faf4011e1128ab5e58ce3912d379481f8320cb (patch) | |
tree | 1628b3ea0b9119eb9af6fbddd68d9b820c5ce2a6 /src/gui/text/qrawfont.cpp | |
parent | c501403cb5a0c9ec21b00e0c2f640ae85566e0cf (diff) | |
download | Qt-f0faf4011e1128ab5e58ce3912d379481f8320cb.zip Qt-f0faf4011e1128ab5e58ce3912d379481f8320cb.tar.gz Qt-f0faf4011e1128ab5e58ce3912d379481f8320cb.tar.bz2 |
Make QtQuick2 compile on QPA
Moved the logic to set pixel size into the font engines to avoid
making the platform plugin interface too complex, and added a function
in QPA to make an isolated font engine based on font data. Currently
none of the QPA back-ends supports it, but it compiles and spits out
a warning if you try to create a QRawFont from data there. This isn't
used in QtQuick2 anyway.
Reviewed-by: Jiang Jiang
Diffstat (limited to 'src/gui/text/qrawfont.cpp')
-rw-r--r-- | src/gui/text/qrawfont.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 4a715c2..6ac2677 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -579,8 +579,19 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ */ void QRawFont::setPixelSize(int pixelSize) { + if (d->fontEngine == 0) + return; + detach(); - d->platformSetPixelSize(pixelSize); + QFontEngine *oldFontEngine = d->fontEngine; + + d->fontEngine = d->fontEngine->cloneWithSize(pixelSize); + if (d->fontEngine != 0) + d->fontEngine->ref.ref(); + + oldFontEngine->ref.deref(); + if (oldFontEngine->cache_count == 0 && oldFontEngine->ref == 0) + delete oldFontEngine; } /*! |