diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/cairotextrender.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/unx/fc_fontoptions.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/unx/fontmanager.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/glyphcache.hxx | 4 | ||||
-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 |
8 files changed, 23 insertions, 51 deletions
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx index 0735d05979e6..1aeaf06ae474 100644 --- a/vcl/inc/unx/cairotextrender.hxx +++ b/vcl/inc/unx/cairotextrender.hxx @@ -26,7 +26,6 @@ #include <deque> -class FontConfigFontOptions; class FreetypeFont; class GlyphCache; typedef struct _cairo cairo_t; @@ -95,8 +94,6 @@ public: #endif }; -FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx index 48661def39a2..3c346107f260 100644 --- a/vcl/inc/unx/fc_fontoptions.hxx +++ b/vcl/inc/unx/fc_fontoptions.hxx @@ -53,6 +53,7 @@ public: bool DontUseHinting() const { return (meHinting == FontHinting::No) || (GetHintStyle() == FontHintStyle::NONE); } void SyncPattern(const OString& rFileName, int nFontFace, bool bEmbolden); FcPattern* GetPattern() const; + static void cairo_font_options_substitute(FcPattern* pPattern); private: FcPattern* mpPattern; }; diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index 057436a5d6a8..7f0e057addf7 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -492,7 +492,7 @@ public: in different fonts in e.g. english and japanese */ void matchFont( FastPrintFontInfo& rInfo, const css::lang::Locale& rLocale ); - static FontConfigFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*)); + static FontConfigFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize); void Substitute( FontSelectPattern &rPattern, OUString& rMissingCodes ); diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 9d3f011595b3..ac52a6a0d9a0 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -252,13 +252,9 @@ public: virtual ~FreetypeFontInstance() override; void SetFreetypeFont(FreetypeFont* p); - void HandleFontOptions(); private: FreetypeFont* mpFreetypeFont; - std::shared_ptr<FontConfigFontOptions> mxFontOptions; - bool mbGotFontOptions; - }; class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout 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) |