diff options
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 38 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/glyphcache.cxx | 1 |
4 files changed, 21 insertions, 43 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 81285ebcb518..dd9d17b7ad28 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -1169,8 +1169,7 @@ void FontConfigFontOptions::SyncPattern(const OString& rFileName, int nIndex, bo FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); } -FontConfigFontOptions* PrintFontManager::getFontOptions( - const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) +FontConfigFontOptions* PrintFontManager::getFontOptions(const FastPrintFontInfo& rInfo, int nSize) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); @@ -1193,8 +1192,7 @@ FontConfigFontOptions* PrintFontManager::getFontOptions( int hintstyle = FC_HINT_FULL; FcConfigSubstitute(pConfig, pPattern, FcMatchPattern); - if (subcallback) - subcallback(pPattern); + FontConfigFontOptions::cairo_font_options_substitute(pPattern); FcDefaultSubstitute(pPattern); FcResult eResult = FcResultNoMatch; diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 55d5e49c5025..eb941e2b384c 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -138,31 +138,12 @@ bool CairoTextRender::setFont( const FontSelectPattern *pEntry, int nFallbackLev // register to use the font mpFreetypeFont[ nFallbackLevel ] = pFreetypeFont; - // apply font specific-hint settings - FreetypeFontInstance* pSFE = static_cast<FreetypeFontInstance*>( pEntry->mpFontInstance ); - pSFE->HandleFontOptions(); - return true; } return false; } -void FreetypeFontInstance::HandleFontOptions() -{ - if( !mpFreetypeFont ) - return; - if( !mbGotFontOptions ) - { - // get and cache the font options - mbGotFontOptions = true; - mxFontOptions.reset(GetFCFontOptions( *maFontSelData.mpFontData, - maFontSelData.mnHeight )); - } - // apply the font options - mpFreetypeFont->SetFontOptions(mxFontOptions); -} - void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId) { maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) ); @@ -461,29 +442,16 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection ) ImplGetSVData()->maGDIData.mbNativeFontConfig = true; } -void cairosubcallback(void* pPattern) +void FontConfigFontOptions::cairo_font_options_substitute(FcPattern* pPattern) { ImplSVData* pSVData = ImplGetSVData(); const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions(); if( !pFontOptions ) return; - cairo_ft_font_options_substitute(pFontOptions, static_cast<FcPattern*>(pPattern)); + cairo_ft_font_options_substitute(pFontOptions, pPattern); } -FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize) -{ - psp::FastPrintFontInfo aInfo; - - aInfo.m_aFamilyName = rFontAttributes.GetFamilyName(); - aInfo.m_eItalic = rFontAttributes.GetItalic(); - aInfo.m_eWeight = rFontAttributes.GetWeight(); - aInfo.m_eWidth = rFontAttributes.GetWidthType(); - - return psp::PrintFontManager::getFontOptions(aInfo, nSize, cairosubcallback); -} - -void -CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel ) +void CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel ) { if( nFallbackLevel >= MAX_FALLBACK ) return; diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 9a72bf35ee08..6df2bba7269a 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -20,7 +20,6 @@ #include <vcl/fontcharmap.hxx> -#include <unx/cairotextrender.hxx> #include "unx/freetype_glyphcache.hxx" #include <vcl/svapp.hxx> @@ -589,14 +588,28 @@ void FreetypeFont::SetFontOptions(const std::shared_ptr<FontConfigFontOptions>& mnLoadFlags |= FT_LOAD_NO_BITMAP; } +namespace +{ + FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize) + { + psp::FastPrintFontInfo aInfo; + + aInfo.m_aFamilyName = rFontAttributes.GetFamilyName(); + aInfo.m_eItalic = rFontAttributes.GetItalic(); + aInfo.m_eWeight = rFontAttributes.GetWeight(); + aInfo.m_eWidth = rFontAttributes.GetWidthType(); + + return psp::PrintFontManager::getFontOptions(aInfo, nSize); + } +} + const std::shared_ptr<FontConfigFontOptions>& FreetypeFont::GetFontOptions() const { if (!mxFontOptions) { - SAL_WARN("vcl", "this doesn't happen in practice I believe"); mxFontOptions.reset(GetFCFontOptions(mpFontInfo->GetFontAttributes(), maFontSelData.mnHeight)); + mxFontOptions->SyncPattern(GetFontFileName(), GetFontFaceIndex(), NeedsArtificialBold()); } - mxFontOptions->SyncPattern(GetFontFileName(), GetFontFaceIndex(), NeedsArtificialBold()); return mxFontOptions; } diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index de4bb9666975..3cece786e7a7 100644 --- a/vcl/unx/generic/glyphs/glyphcache.cxx +++ b/vcl/unx/generic/glyphs/glyphcache.cxx @@ -343,7 +343,6 @@ void FreetypeFont::GarbageCollect( long nMinLruIndex ) FreetypeFontInstance::FreetypeFontInstance( FontSelectPattern& rFSD ) : LogicalFontInstance( rFSD ) , mpFreetypeFont( nullptr ) -, mbGotFontOptions( false ) {} void FreetypeFontInstance::SetFreetypeFont(FreetypeFont* p) |