diff options
author | Khaled Hosny <khaled@aliftype.com> | 2022-10-01 08:21:58 +0200 |
---|---|---|
committer | خالد حسني <khaled@aliftype.com> | 2022-10-01 13:09:48 +0200 |
commit | 112d07027c4484dd571519911596d11eae897524 (patch) | |
tree | 0b33c5f4970ad3e2dced137581e3cf6d46931930 /vcl/unx | |
parent | c107d08460938270cbc2a32a89d995fc0ae8ebea (diff) |
vcl: Use PhysicalFontFace::GetRawFontData() for font embedding
Change-Id: I6f7c4508f7cef022eaf65a998cb242078d3771c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140826
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/gdi/font.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/freetypetextrender.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 47 |
3 files changed, 0 insertions, 67 deletions
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx index 1246d9b525f8..ab7ceaf8c7e7 100644 --- a/vcl/unx/generic/gdi/font.cxx +++ b/vcl/unx/generic/gdi/font.cxx @@ -81,14 +81,4 @@ std::unique_ptr<GenericSalLayout> X11SalGraphics::GetTextLayout(int nFallbackLev return mxTextRenderImpl->GetTextLayout(nFallbackLevel); } -const void* X11SalGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) -{ - return mxTextRenderImpl->GetEmbedFontData(pFont, pDataLen); -} - -void X11SalGraphics::FreeEmbedFontData( const void* pData, tools::Long nLen ) -{ - mxTextRenderImpl->FreeEmbedFontData(pData, nLen); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx b/vcl/unx/generic/gdi/freetypetextrender.cxx index b1416721fea6..dcf53bc40083 100644 --- a/vcl/unx/generic/gdi/freetypetextrender.cxx +++ b/vcl/unx/generic/gdi/freetypetextrender.cxx @@ -127,14 +127,4 @@ std::unique_ptr<GenericSalLayout> FreeTypeTextRenderImpl::GetTextLayout(int nFal return std::make_unique<GenericSalLayout>(*mpFreetypeFont[nFallbackLevel]); } -const void* FreeTypeTextRenderImpl::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) -{ - return GenPspGraphics::GetEmbedFontDataHelper(pFont, pDataLen); -} - -void FreeTypeTextRenderImpl::FreeEmbedFontData( const void* pData, tools::Long nLen ) -{ - GenPspGraphics::FreeEmbedFontDataHelper(pData, nLen); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index dcfdadc64cda..fe3e37627fd9 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -396,51 +396,4 @@ css::uno::Any GenPspGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& /* #endif // ENABLE_CAIRO_CANVAS -void GenPspGraphics::FreeEmbedFontDataHelper( const void* pData, tools::Long nLen ) -{ - if( pData ) - munmap( const_cast<void *>(pData), nLen ); -} - -const void* GenPspGraphics::GetEmbedFontDataHelper(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) -{ - // in this context the pFont->GetFontId() is a valid PSP - // font since they are the only ones left after the PDF - // export has filtered its list of subsettable fonts (for - // which this method was created). The correct way would - // be to have the FreetypeManager search for the PhysicalFontFace pFont - psp::fontID aFont = pFont->GetFontId(); - - psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - - OString aSysPath = rMgr.getFontFileSysPath( aFont ); - - int fd = open( aSysPath.getStr(), O_RDONLY ); - if( fd < 0 ) - return nullptr; - struct stat aStat; - if( fstat( fd, &aStat ) ) - { - close( fd ); - return nullptr; - } - void* pFile = mmap( nullptr, aStat.st_size, PROT_READ, MAP_SHARED, fd, 0 ); - close( fd ); - if( pFile == MAP_FAILED ) - return nullptr; - *pDataLen = aStat.st_size; - - return pFile; -} - -void GenPspGraphics::FreeEmbedFontData( const void* pData, tools::Long nLen ) -{ - FreeEmbedFontDataHelper(pData, nLen); -} - -const void* GenPspGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) -{ - return GetEmbedFontDataHelper(pFont, pDataLen); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |