[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 4 19:15:05 UTC 2019
vcl/unx/generic/fontmanager/fontconfig.cxx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 29411e7c08ec249116ee0211888e47c8b6f57707
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 4 14:52:31 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 4 21:14:23 2019 +0200
Related: rhbz#1648281 improve fontconfig fallback for emojis
disregard text language for emoji and tag with und-zsye to
get fontconfig to give us the default emoji font
Change-Id: I8f94b0c41dea3204c9db77b96ad8f0d98bae2239
Reviewed-on: https://gerrit.libreoffice.org/78600
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 9fd6b380b73a..2767cafcf07f 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -798,6 +798,11 @@ namespace
#endif
}
+ bool isEmoji(sal_uInt32 nCurrentChar)
+ {
+ return u_hasBinaryProperty(nCurrentChar, UCHAR_EMOJI);
+ }
+
//returns true if the given code-point couldn't possibly be in rLangTag.
bool isImpossibleCodePointForLang(const LanguageTag &rLangTag, sal_uInt32 currentChar)
{
@@ -846,6 +851,8 @@ namespace
OUString getExemplarLangTagForCodePoint(sal_uInt32 currentChar)
{
+ if (isEmoji(currentChar))
+ return "und-zsye";
int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
UScriptCode eScript = static_cast<UScriptCode>(script);
OStringBuffer aBuf(unicode::getExemplarLanguageForUScriptCode(eScript));
@@ -904,7 +911,7 @@ void PrintFontManager::Substitute(FontSelectPattern &rPattern, OUString& rMissin
FcCharSetAddChar( codePoints, nCode );
//if the codepoint is impossible for this lang tag, then clear it
//and autodetect something useful
- if (!aLangAttrib.isEmpty() && isImpossibleCodePointForLang(aLangTag, nCode))
+ if (!aLangAttrib.isEmpty() && (isImpossibleCodePointForLang(aLangTag, nCode) || isEmoji(nCode)))
aLangAttrib.clear();
//#i105784#/rhbz#527719 improve selection of fallback font
if (aLangAttrib.isEmpty())
More information about the Libreoffice-commits
mailing list