From 2967e7a87986b59fe48119749525d4084ac6a568 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Fri, 11 Sep 2020 22:31:51 +0200 Subject: 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 Tested-by: Jenkins --- vcl/win/gdi/salfont.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'vcl/win/gdi/salfont.cxx') diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index f5f69f3eab33..bc7f83b8b6f2 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1543,7 +1543,7 @@ public: ~ScopedTrueTypeFont(); - SFErrCodes open(void const * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum); + SFErrCodes open(void const * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum, const FontCharMapRef xCharMap = nullptr); TrueTypeFont * get() const { return m_pFont; } TrueTypeFont* operator->() { return m_pFont; } @@ -1561,10 +1561,10 @@ ScopedTrueTypeFont::~ScopedTrueTypeFont() } SFErrCodes ScopedTrueTypeFont::open(void const * pBuffer, sal_uInt32 nLen, - sal_uInt32 nFaceNum) + sal_uInt32 nFaceNum, const FontCharMapRef xCharMap) { OSL_ENSURE(m_pFont == nullptr, "already open"); - return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont); + return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont, xCharMap); } bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, @@ -1629,7 +1629,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, nFaceNum = ~0U; // indicate "TTC font extracts only" ScopedTrueTypeFont aSftTTF; - SFErrCodes nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum ); + SFErrCodes nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum, pFont->GetFontCharMap()); if( nRC != SFErrCodes::Ok ) return false; @@ -1745,7 +1745,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, nFaceNum = ~0U; // indicate "TTC font extracts only" ScopedTrueTypeFont aSftTTF; - SFErrCodes nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum ); + SFErrCodes nRC = aSftTTF.open(xRawFontData.get(), xRawFontData.size(), nFaceNum, pFont->GetFontCharMap()); if( nRC != SFErrCodes::Ok ) return; -- cgit