diff options
author | Khaled Hosny <khaled@aliftype.com> | 2022-09-04 20:39:22 +0200 |
---|---|---|
committer | خالد حسني <khaled@aliftype.com> | 2022-09-05 06:09:11 +0200 |
commit | ca7d6be2d64a48e61db7a1c614d6325151817f59 (patch) | |
tree | 437d23cc5944a8814a0c4bb739c8af420867f662 /vcl/unx/generic | |
parent | 8f9638424f7f88c99ff16a8015ca343f3042b26d (diff) |
vcl: Consolidate PhysicalFontFace::GetFontCharMap()
All subclasses are doing the same thing in slightly different ways, so
move it to the base class that we can now access font tables there.
Also drop unused PhysicalFontFace::HasChar().
Change-Id: I77022b4dc3688de2788c18966f39f407a6abb730
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139340
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/freetypetextrender.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 33 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 2 |
3 files changed, 2 insertions, 35 deletions
diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx b/vcl/unx/generic/gdi/freetypetextrender.cxx index 1ec3a1522b8e..2e748bf85711 100644 --- a/vcl/unx/generic/gdi/freetypetextrender.cxx +++ b/vcl/unx/generic/gdi/freetypetextrender.cxx @@ -73,7 +73,7 @@ FontCharMapRef FreeTypeTextRenderImpl::GetFontCharMap() const { if (!mpFreetypeFont[0]) return nullptr; - return mpFreetypeFont[0]->GetFreetypeFont().GetFontCharMap(); + return mpFreetypeFont[0]->GetFontFace()->GetFontCharMap(); } bool FreeTypeTextRenderImpl::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 5945a4813326..5e55b502090b 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -663,44 +663,11 @@ bool FreetypeFont::GetAntialiasAdvice() const return !mrFontInstance.GetFontSelectPattern().mbNonAntialiased && (mnPrioAntiAlias > 0); } -// determine unicode ranges in font - -const FontCharMapRef & FreetypeFont::GetFontCharMap() const -{ - return mxFontInfo->GetFontCharMap(); -} - bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const { return mxFontInfo->GetFontCapabilities(rFontCapabilities); } -const FontCharMapRef & FreetypeFontInfo::GetFontCharMap() const -{ - // check if the charmap is already cached - if( mxFontCharMap.is() ) - return mxFontCharMap; - - // get the charmap and cache it - CmapResult aCmapResult; - aCmapResult.mbSymbolic = IsSymbolFont(); - - sal_uLong nLength = 0; - const unsigned char* pCmap = GetTable("cmap", &nLength); - if (pCmap && (nLength > 0) && ParseCMAP(pCmap, nLength, aCmapResult)) - { - FontCharMapRef xFontCharMap( new FontCharMap ( aCmapResult ) ); - mxFontCharMap = xFontCharMap; - } - else - { - FontCharMapRef xFontCharMap( new FontCharMap() ); - mxFontCharMap = xFontCharMap; - } - // mxFontCharMap on either branch now has a refcount of 1 - return mxFontCharMap; -} - bool FreetypeFontInfo::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const { bool bRet = false; diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index ce29ecfeb51b..b1068082c26d 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -142,7 +142,7 @@ FontCharMapRef GenPspGraphics::GetFontCharMap() const if (!m_pFreetypeFont[0]) return nullptr; - return m_pFreetypeFont[0]->GetFreetypeFont().GetFontCharMap(); + return m_pFreetypeFont[0]->GetFontFace()->GetFontCharMap(); } bool GenPspGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const |