diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2016-03-22 14:16:23 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2016-03-29 17:37:35 +0000 |
commit | c35795b413c6aedd6b02f03fdcaa5fb4888084d5 (patch) | |
tree | 0ffd580344518eb544d9951f47bcac2769d6ae4c /src/gui | |
parent | 72ff2a2f0db1e728d2a53f546021018e076bbfb5 (diff) |
QFontEngine: Add handle() function
Both QFont::handle() and QFont::freetypeFace() used to
be available in Qt 4 but were removed in Qt 5. There's
currently no API to get access to the native font handle,
which the font engine holds in a way or another.
Similar to the way it was in Qt 4, the actual handle type
depends on the font engine currently in use. The types map
as follows:
Font Engine Native Handle
------------------------------------
DirectWrite IDWriteFontFace *
Freetype FT_Face
Mac CTFontRef
Win HFONT
All other font engines return a null handle.
Change-Id: I3bea8259ac1378fd24079723aa6603bf9e74834c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 2 |
4 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 03ad6a24e9..39348a52b0 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1229,6 +1229,11 @@ int QFontEngine::glyphCount() const return count; } +Qt::HANDLE QFontEngine::handle() const +{ + return Q_NULLPTR; +} + const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) { const uchar *header = table; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 8fbeff3596..ebfd2a8182 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -2005,6 +2005,11 @@ QFontEngine *QFontEngineFT::cloneWithSize(qreal pixelSize) const } } +Qt::HANDLE QFontEngineFT::handle() const +{ + return non_locked_face(); +} + QT_END_NAMESPACE #endif // QT_NO_FREETYPE diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 6f05645a3f..a1bd21dab9 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -283,6 +283,7 @@ private: void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE; QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; + Qt::HANDLE handle() const Q_DECL_OVERRIDE; bool initFromFontEngine(const QFontEngineFT *fontEngine); HintStyle defaultHintStyle() const { return default_hint_style; } diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index be9eaa5020..7ddc5c0c32 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -229,6 +229,8 @@ public: virtual QFontEngine *cloneWithSize(qreal /*pixelSize*/) const { return 0; } + virtual Qt::HANDLE handle() const; + void *harfbuzzFont() const; void *harfbuzzFace() const; bool supportsScript(QChar::Script script) const; |