summaryrefslogtreecommitdiff
path: root/vcl/quartz
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-09-11 17:24:59 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-15 06:42:13 +0200
commita88c9752c6251dceb77c809b4592f2516e10f3e6 (patch)
tree02897cee4668de625f874bb6a72b1f8455a37636 /vcl/quartz
parentfb50c96b4207f7effb9e656ae9c8ec8d25d625ca (diff)
WIN OSX unify GetGlyphWidths code
Now that GetFontChatMap is a member of PhysicalFontFace, we can copy the common part of both architectures into a SalGraphics helper function. Change-Id: Iad379ea690a1c5346b69b5042188506ccf575cc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102684 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/quartz')
-rw-r--r--vcl/quartz/salgdi.cxx46
1 files changed, 1 insertions, 45 deletions
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 4cab7731eca5..2c1fdff16eec 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -763,51 +763,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
if( nRC != SFErrCodes::Ok )
return;
- const int nGlyphCount = pSftFont->glyphCount();
- if( nGlyphCount > 0 )
- {
- // get glyph metrics
- rGlyphWidths.resize(nGlyphCount);
- std::vector<sal_uInt16> aGlyphIds(nGlyphCount);
- for( int i = 0; i < nGlyphCount; i++ )
- {
- aGlyphIds[i] = static_cast<sal_uInt16>(i);
- }
-
- std::unique_ptr<sal_uInt16[]> pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aGlyphIds.data(),
- nGlyphCount, bVertical );
- if( pGlyphMetrics )
- {
- for( int i = 0; i < nGlyphCount; ++i )
- {
- rGlyphWidths[i] = pGlyphMetrics[i];
- }
- pGlyphMetrics.reset();
- }
-
- rtl::Reference<CoreTextFontFace> rCTFontData(new CoreTextFontFace(*pFontData, pFontData->GetFontId()));
- FontCharMapRef xFCMap = rCTFontData->GetFontCharMap();
- SAL_WARN_IF( !xFCMap.is() || !xFCMap->GetCharCount(), "vcl", "no charmap" );
-
- // get unicode<->glyph encoding
- // TODO? avoid sft mapping by using the xFCMap itself
- int nCharCount = xFCMap->GetCharCount();
- sal_uInt32 nChar = xFCMap->GetFirstChar();
- for( ; --nCharCount >= 0; nChar = xFCMap->GetNextChar( nChar ) )
- {
- if( nChar > 0xFFFF ) // TODO: allow UTF-32 chars
- break;
-
- sal_Ucs nUcsChar = static_cast<sal_Ucs>(nChar);
- sal_uInt32 nGlyph = ::MapChar( pSftFont, nUcsChar );
- if( nGlyph > 0 )
- {
- rUnicodeEnc[ nUcsChar ] = nGlyph;
- }
- }
-
- xFCMap = nullptr;
- }
+ SalGraphics::GetGlyphWidths(*pSftFont, *pFontData, bVertical, rGlyphWidths, rUnicodeEnc);
::CloseTTFont( pSftFont );
}