diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-04 14:52:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-04 21:14:23 +0200 |
commit | 29411e7c08ec249116ee0211888e47c8b6f57707 (patch) | |
tree | 4c13718ac996bd228caa6d02b18ea3f78e22d99a /vcl/unx/generic/fontmanager/fontconfig.cxx | |
parent | cd563e7b807fe038ebefb228e70bc587c040d17d (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/generic/fontmanager/fontconfig.cxx')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
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()) |