[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 30 08:53:12 UTC 2020


 vcl/unx/generic/fontmanager/fontconfig.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit dc8f77f1a032bcba0c1654b3c763fbf898f860bd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 4 14:52:31 2019 +0100
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Nov 30 09:52:39 2020 +0100

    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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106837
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index ffd36c62f7bb..5e3206affed5 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -796,6 +796,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)
     {
@@ -844,6 +849,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));
@@ -902,7 +909,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