diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-10-27 12:24:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-10-27 12:49:14 +0100 |
commit | 58b48f188bbfd9a3382460d6de63848eb3db416d (patch) | |
tree | 37d09873eec39ff18a5f9cdb910ea6fe4a1f38cc /vcl/generic | |
parent | d9d82ffc6b16051f002e297109509488972a9c92 (diff) |
Resolves: fdo#32665 handle that FreeSerif lacks some glyphs in bold/italic
FreeSerif lacks glyphs in bold/italic variants that it has in the normal one. A
lot of our glyph fallback infrastructure, especially the caches don't expect
that a normal variant of a font with extra emboldening or extra font skew can
be a fallback for a bold/italic variant of itself which exists, but doesn't
have the missing glyphs that the normal one does.
We really need to improve our glyph/font caching, but we can get 90% of the
way there by excluding such cases from the caches.
Diffstat (limited to 'vcl/generic')
-rw-r--r-- | vcl/generic/fontmanager/fontconfig.cxx | 18 | ||||
-rw-r--r-- | vcl/generic/fontmanager/fontsubst.cxx | 6 | ||||
-rw-r--r-- | vcl/generic/glyphs/glyphcache.cxx | 7 |
3 files changed, 28 insertions, 3 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx index be91349eadc4..a4f5f7fd5bfa 100644 --- a/vcl/generic/fontmanager/fontconfig.cxx +++ b/vcl/generic/fontmanager/fontconfig.cxx @@ -68,6 +68,9 @@ using namespace psp; #ifndef FC_EMBOLDEN #define FC_EMBOLDEN "embolden" #endif +#ifndef FC_MATRIX + #define FC_MATRIX "matrix" +#endif #ifndef FC_FONTFORMAT #define FC_FONTFORMAT "fontformat" #endif @@ -747,7 +750,7 @@ static void addtopattern(FcPattern *pPattern, rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, FontItalic &rItalic, FontWeight &rWeight, - FontWidth &rWidth, FontPitch &rPitch) const + FontWidth &rWidth, FontPitch &rPitch, bool &rEmbolden, ItalicMatrix &rMatrix) const { rtl::OUString aName; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); @@ -834,6 +837,17 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, rPitch = convertSpacing(val); if (FcResultMatch == FcPatternGetInteger(pSet->fonts[0], FC_WIDTH, 0, &val)) rWidth = convertWidth(val); + FcBool bEmbolden; + if (FcResultMatch == FcPatternGetBool(pSet->fonts[0], FC_EMBOLDEN, 0, &bEmbolden)) + rEmbolden = bEmbolden; + FcMatrix *pMatrix = 0; + if (FcResultMatch == FcPatternGetMatrix(pSet->fonts[0], FC_MATRIX, 0, &pMatrix)) + { + rMatrix.xx = pMatrix->xx; + rMatrix.xy = pMatrix->xy; + rMatrix.yx = pMatrix->yx; + rMatrix.yy = pMatrix->yy; + } } // update rMissingCodes by removing resolved unicodes @@ -844,7 +858,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, FcCharSet* unicodes; if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes)) { - for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) + for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) { // also handle unicode surrogates const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex ); diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx index 3bf2d0786719..2d187b18cbf7 100644 --- a/vcl/generic/fontmanager/fontsubst.cxx +++ b/vcl/generic/fontmanager/fontsubst.cxx @@ -127,10 +127,14 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData FontWeight eWeight = rFontSelData.GetWeight(); FontWidth eWidth = rFontSelData.GetWidthType(); FontPitch ePitch = rFontSelData.GetPitch(); + bool bEmbolden = rFontSelData.mbEmbolden; + ItalicMatrix aMatrix = rFontSelData.maItalicMatrix; const psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch); + aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch, bEmbolden, aMatrix ); + aRet.maItalicMatrix = aMatrix; + aRet.mbEmbolden = bEmbolden; aRet.meItalic = eItalic; aRet.meWeight = eWeight; aRet.meWidthType = eWidth; diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx index 5322b6502310..fa712bb8dc9e 100644 --- a/vcl/generic/glyphs/glyphcache.cxx +++ b/vcl/generic/glyphs/glyphcache.cxx @@ -163,6 +163,13 @@ bool GlyphCache::IFSD_Equal::operator()( const ImplFontSelectData& rA, const Imp != STRING_NOTFOUND) && rA.maTargetName != rB.maTargetName) return false; #endif + + if (rA.mbEmbolden != rB.mbEmbolden) + return false; + + if (rA.maItalicMatrix != rB.maItalicMatrix) + return false; + return true; } |