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/qfontengine_ft.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/qfontengine_ft.cpp')
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 8f2da9b..58bcca8 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -2069,6 +2069,41 @@ HB_Error QFontEngineFT::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 p return result; } +bool QFontEngineFT::initFromFontEngine(const QFontEngineFT *fe) +{ + if (!init(fe->faceId(), fe->antialias, fe->defaultFormat, fe->freetype)) + return false; + + // Increase the reference of this QFreetypeFace since one more QFontEngineFT + // will be using it + freetype->ref.ref(); + + default_load_flags = fe->default_load_flags; + default_hint_style = fe->default_hint_style; + antialias = fe->antialias; + transform = fe->transform; + embolden = fe->embolden; + subpixelType = fe->subpixelType; + lcdFilterType = fe->lcdFilterType; + canUploadGlyphsToServer = fe->canUploadGlyphsToServer; + embeddedbitmap = fe->embeddedbitmap; + + return true; +} + +QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const +{ + QFontDef fontDef; + fontDef.pixelSize = pixelSize; + QFontEngineFT *fe = new QFontEngineFT(fontDef); + if (!fe->initFromFontEngine(this)) { + delete fe; + return 0; + } else { + return fe; + } +} + QT_END_NAMESPACE #endif // QT_NO_FREETYPE |