diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-11-29 13:39:37 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2016-11-29 22:51:26 +0000 |
commit | 2e0ab512592e2e134faf9612a293fb8fdd0527d0 (patch) | |
tree | f302654d0f3b23da6603bf4ad7b8ef7905cd9be7 /vcl/win/gdi | |
parent | 70ecf1919e3e3b9509ff55b2265b3d98d2a5f1aa (diff) |
Strip down GetEmbedFontData to what is really used
The only remaining user is EmbeddedFontsHelper, and it just needs the
raw font data.
Change-Id: Ia15c59158b5c9e44d0936463553303a3c8b6e0f5
Reviewed-on: https://gerrit.libreoffice.org/31374
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/win/gdi')
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 7f7f681dcba1..5d1e6bc9b20d 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1903,15 +1903,12 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, return (nRC == SF_OK); } -const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, - const sal_Unicode* pUnicodes, sal_Int32* pCharWidths, size_t nLen, - FontSubsetInfo& rInfo, long* pDataLen ) +const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, long* pDataLen) { // create matching FontSelectPattern // we need just enough to get to the font file data FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); SetFont( &aIFSD, 0 ); @@ -1921,39 +1918,6 @@ const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, if( !aRawFontData.get() ) return nullptr; - // get important font properties - TEXTMETRICA aTm; - if( !::GetTextMetricsA( getHDC(), &aTm ) ) - *pDataLen = 0; - const bool bPFA = (*aRawFontData.get() < 0x80); - rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; - WCHAR aFaceName[64]; - sal_Int32 nFNLen = ::GetTextFaceW( getHDC(), 64, aFaceName ); - // #i59854# strip eventual null byte - while( nFNLen > 0 && aFaceName[nFNLen-1] == 0 ) - nFNLen--; - if( nFNLen == 0 ) - *pDataLen = 0; - rInfo.m_aPSName = OUString(reinterpret_cast<const sal_Unicode*>(aFaceName), nFNLen); - rInfo.m_nAscent = +aTm.tmAscent; - rInfo.m_nDescent = -aTm.tmDescent; - rInfo.m_aFontBBox = Rectangle( Point( -aTm.tmOverhang, -aTm.tmDescent ), - Point( aTm.tmMaxCharWidth, aTm.tmAscent+aTm.tmExternalLeading ) ); - rInfo.m_nCapHeight = aTm.tmAscent; // Well ... - - // get individual character widths - for (size_t i = 0; i < nLen; ++i) - { - int nCharWidth = 0; - const sal_Unicode cChar = pUnicodes[i]; - if( !::GetCharWidth32W( getHDC(), cChar, cChar, &nCharWidth ) ) - *pDataLen = 0; - pCharWidths[i] = nCharWidth; - } - - if( !*pDataLen ) - return nullptr; - const unsigned char* pData = aRawFontData.steal(); return pData; } |