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

New commits:
commit bd216254af4bb695afbd1e957d02a2a162a08106
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Sep 4 14:52:31 2019 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Fri Sep 6 11:01:05 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/78609
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 8e3e9163d1ce..c7bfbb47e9bd 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())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to