[Libreoffice-commits] core.git: vcl/generic
Caolán McNamara
caolanm at redhat.com
Mon Feb 11 04:53:18 PST 2013
vcl/generic/fontmanager/fontconfig.cxx | 35 +++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
New commits:
commit 949bc0cbbcad19d1f4a9de0813c9eb83f79234cf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Feb 11 12:51:22 2013 +0000
Resolves: rhbz#527719 #i105784# improve selection of fallback font
Change-Id: Ib935ebd1609d4584d464e42fa418c2e91202e59b
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 0efdbe4..67506d8 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -832,7 +832,6 @@ namespace
#endif
}
-#if defined(ENABLE_DBUS) && defined(ENABLE_PACKAGEKIT)
LanguageTag getExemplerLangTagForCodePoint(sal_uInt32 currentChar)
{
int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
@@ -844,6 +843,7 @@ namespace
return LanguageTag(OStringToOUString(aBuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
}
+#if defined(ENABLE_DBUS) && defined(ENABLE_PACKAGEKIT)
guint get_xid_for_dbus()
{
const Window *pTopWindow = Application::IsHeadlessModeEnabled() ? NULL : Application::GetActiveTopWindow();
@@ -927,25 +927,32 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, rtl::OUString& r
const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr();
FcPatternAddString(pPattern, FC_FAMILY, pTargetNameUtf8);
- const LanguageTag aLangTag(rPattern.meLanguage);
- const rtl::OString aLangAttrib = mapToFontConfigLangTag(aLangTag);
- if (!aLangAttrib.isEmpty())
- FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr());
+ LanguageTag aLangTag(rPattern.meLanguage);
+ OString aLangAttrib = mapToFontConfigLangTag(aLangTag);
// Add required Unicode characters, if any
if ( !rMissingCodes.isEmpty() )
{
- FcCharSet *unicodes = FcCharSetCreate();
- for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
- {
- // also handle unicode surrogates
- const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
- FcCharSetAddChar( unicodes, nCode );
- }
- FcPatternAddCharSet(pPattern, FC_CHARSET, unicodes);
- FcCharSetDestroy(unicodes);
+ FcCharSet *unicodes = FcCharSetCreate();
+ for( sal_Int32 nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
+ {
+ // also handle unicode surrogates
+ const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
+ FcCharSetAddChar( unicodes, nCode );
+ //#i105784#/rhbz#527719 improve selection of fallback font
+ if (aLangAttrib.isEmpty())
+ {
+ aLangTag = getExemplerLangTagForCodePoint(nCode);
+ aLangAttrib = mapToFontConfigLangTag(aLangTag);
+ }
+ }
+ FcPatternAddCharSet(pPattern, FC_CHARSET, unicodes);
+ FcCharSetDestroy(unicodes);
}
+ if (!aLangAttrib.isEmpty())
+ FcPatternAddString(pPattern, FC_LANG, (FcChar8*)aLangAttrib.getStr());
+
addtopattern(pPattern, rPattern.GetSlant(), rPattern.GetWeight(),
rPattern.GetWidthType(), rPattern.GetPitch());
More information about the Libreoffice-commits
mailing list