diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-09-11 22:31:51 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-09-15 06:42:56 +0200 |
commit | 2967e7a87986b59fe48119749525d4084ac6a568 (patch) | |
tree | 3c8f27ddc5278903639f5f7c09e1d028b6be0103 /vcl/qt5 | |
parent | c7482bc2904401e7d975b5721ec861b8589253f9 (diff) |
Forward existing FontCharMap from PhysicalFontFace
Since removed code in the previous commit is primary used in
CreateFontSubset and GetGlyphWidths, you have a high chance, that
the CMAP was already used for displaying a font, so it's already
decoded and can be forwarded. Also the lookup should be faster in
general this way.
Change-Id: Icf4d8a1a84ff6ccdaccb7e870abe5df3837f9541
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102686
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Tested-by: Jenkins
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5Graphics_Text.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index 0fe602d1ce3f..0b823858a9bb 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -137,14 +137,15 @@ class Qt5TrueTypeFont : public vcl::AbstractTrueTypeFont mutable QByteArray m_aFontTable[vcl::NUM_TAGS]; public: - Qt5TrueTypeFont(const QRawFont& aRawFont); + Qt5TrueTypeFont(const Qt5FontFace& aFontFace, const QRawFont& aRawFont); bool hasTable(sal_uInt32 ord) const override; const sal_uInt8* table(sal_uInt32 ord, sal_uInt32& size) const override; }; -Qt5TrueTypeFont::Qt5TrueTypeFont(const QRawFont& aRawFont) - : m_aRawFont(aRawFont) +Qt5TrueTypeFont::Qt5TrueTypeFont(const Qt5FontFace& aFontFace, const QRawFont& aRawFont) + : vcl::AbstractTrueTypeFont(nullptr, aFontFace.GetFontCharMap()) + , m_aRawFont(aRawFont) { indexGlyphData(); } @@ -224,7 +225,8 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa return false; // get the raw-bytes from the font to be subset - const QFont aFont = static_cast<const Qt5FontFace*>(pFontFace)->CreateFont(); + const Qt5FontFace* pQt5FontFace = static_cast<const Qt5FontFace*>(pFontFace); + const QFont aFont = pQt5FontFace->CreateFont(); const QRawFont aRawFont(QRawFont::fromFont(aFont)); const QFontInfo aFontInfo(aFont); const OString aToFile(OUStringToOString(aSysPath, osl_getThreadTextEncoding())); @@ -249,7 +251,7 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa rInfo.m_nAscent = aRawFont.ascent(); rInfo.m_nDescent = aRawFont.descent(); - Qt5TrueTypeFont aTTF(aRawFont); + Qt5TrueTypeFont aTTF(*pQt5FontFace, aRawFont); int nXmin, nYmin, nXmax, nYmax; sal_uInt16 nMacStyleFlags; if (GetTTGlobalFontHeadInfo(&aTTF, nXmin, nYmin, nXmax, nYmax, nMacStyleFlags)) |