summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-09-11 06:27:23 +0200
committerخالد حسني <khaled@aliftype.com>2022-09-11 09:54:16 +0200
commit38db900c1f7b471dfdf575bbda522a792db51372 (patch)
tree003257fb312afbff2c81667110f3b2d9b3cd0509 /vcl/source/gdi
parent4286e745bccc7393ecd8b06346306d13d23316b5 (diff)
vcl: Move CreateFontSubset() to PhysicalFontFace
Having it in SalGraphics is not necessary as the code now depends on PhysicalFontFace for accessing raw font data, and this consolidates all the near identical copies of this code into one. Change-Id: I8a411f102fd2188a456bdeb8a0d794078d74e47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139762 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx13
1 files changed, 3 insertions, 10 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1f032c25a79e..4f4c2cbfde4b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2327,9 +2327,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const vcl::font:
aInfo.m_aFontBBox = tools::Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) );
aInfo.m_aPSName = pFont->GetFamilyName();
- SalGraphics *pGraphics = GetGraphics();
- assert(pGraphics);
-
aSubType = OString( "/TrueType" );
OUString aTmpName;
@@ -2346,7 +2343,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const vcl::font:
// We are interested only in filling aInfo
sal_GlyphId aGlyphIds[256] = { 0 };
sal_uInt8 pEncoding[256] = { 0 };
- pGraphics->CreateFontSubset(aTmpName, pFont, aGlyphIds, pEncoding, 256, aInfo);
+ pFont->CreateFontSubset(aTmpName, aGlyphIds, pEncoding, 256, aInfo);
osl_removeFile( aTmpName.pData );
// write font descriptor
@@ -2638,11 +2635,6 @@ void PDFWriterImpl::appendBuildinFontsToDict( OStringBuffer& rDict ) const
bool PDFWriterImpl::emitFonts()
{
- SalGraphics *pGraphics = GetGraphics();
-
- if (!pGraphics)
- return false;
-
OStringBuffer aLine( 1024 );
std::map< sal_Int32, sal_Int32 > aFontIDToObject;
@@ -2690,7 +2682,8 @@ bool PDFWriterImpl::emitFonts()
}
}
FontSubsetInfo aSubsetInfo;
- if( pGraphics->CreateFontSubset( aTmpName, subset.first, aGlyphIds, pEncoding, nGlyphs, aSubsetInfo ) )
+ const auto* pFace = subset.first;
+ if (pFace->CreateFontSubset(aTmpName, aGlyphIds, pEncoding, nGlyphs, aSubsetInfo))
{
// create font stream
osl::File aFontFile(aTmpName);