[libreoffice] Related: rhbz#968892 discard impossible languages for glyph fallback

Caolán McNamara caolanm at fedoraproject.org
Tue Jun 4 16:16:39 UTC 2013


commit 2ba3ff3a3e278690a665cc2e4a6188373c286082
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 4 17:16:16 2013 +0100

    Related: rhbz#968892 discard impossible languages for glyph fallback

 ...z-968892-discard-impossible-languages-for.patch |   71 ++++++++++++++++++++
 libreoffice.spec                                   |    3 +
 2 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/0001-Related-rhbz-968892-discard-impossible-languages-for.patch b/0001-Related-rhbz-968892-discard-impossible-languages-for.patch
new file mode 100644
index 0000000..a5754dd
--- /dev/null
+++ b/0001-Related-rhbz-968892-discard-impossible-languages-for.patch
@@ -0,0 +1,71 @@
+From b5bd2d1d8d09a44af354584ff187d9e935ffd973 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 4 Jun 2013 17:13:13 +0100
+Subject: [PATCH] Related: rhbz#968892 discard impossible languages for glyph
+ fallback
+
+Change-Id: I14f1bab09eb0be9c2c896a1dde45913b99aab6df
+---
+ vcl/generic/fontmanager/fontconfig.cxx | 39 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
+index 1b36980..ff471fa 100644
+--- a/vcl/generic/fontmanager/fontconfig.cxx
++++ b/vcl/generic/fontmanager/fontconfig.cxx
+@@ -847,6 +847,41 @@ namespace
+ #endif
+     }
+ 
++    //returns true if the given code-point couldn't possibly be in rLangTag.
++    bool isImpossibleCodePointForLang(const LanguageTag &rLangTag, sal_uInt32 currentChar)
++    {
++        //a non-default script is set, lets believe it
++        if (rLangTag.hasScript())
++            return false;
++
++        int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
++        UScriptCode eScript = static_cast<UScriptCode>(script);
++        bool bIsImpossible = false;
++        OUString sLang = rLangTag.getLanguage();
++        switch (eScript)
++        {
++            case USCRIPT_TELUGU:
++                bIsImpossible = sLang != "te";
++                break;
++            case USCRIPT_BENGALI:
++                bIsImpossible = sLang != "bn" &&
++                    sLang != "as" && sLang != "mkb" &&
++                    sLang != "kfv" && sLang != "ccp" &&
++                    sLang != "tnv" && sLang != "ctg" &&
++                    sLang != "haj" && sLang != "ksy" &&
++                    sLang != "rkt" && sLang != "rjs" &&
++                    sLang != "rhg" && sLang != "syl" &&
++                    sLang != "kyv" && sLang != "zrg" &&
++                    sLang != "nhh";
++                break;
++            default:
++                break;
++        }
++        SAL_WARN_IF(bIsImpossible, "vcl", "Throwing away user set language of "
++            << sLang << " for finding a font for glyph fallback and autodetecting instead");
++        return bIsImpossible;
++    }
++
+     LanguageTag getExemplerLangTagForCodePoint(sal_uInt32 currentChar)
+     {
+         int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
+@@ -954,6 +989,10 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi
+             // also handle unicode surrogates
+             const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
+             FcCharSetAddChar( unicodes, nCode );
++            //if the codepoint is impossible for this lang tag, then clear it
++            //and autodetect something useful
++            if (!aLangAttrib.isEmpty() && isImpossibleCodePointForLang(aLangTag, nCode))
++                aLangAttrib = OString();
+             //#i105784#/rhbz#527719  improve selection of fallback font
+             if (aLangAttrib.isEmpty())
+             {
+-- 
+1.8.1.4
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 92dad94..79bfec1 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -253,6 +253,7 @@ Patch20: 0001-don-t-run-autogen.sh-if-building-from-tarballs.patch
 Patch21: 0001-autosize-the-frame-direction-listbox.patch
 Patch22: 0001-setting-max-line-count-should-allow-extra-values-to-.patch
 Patch23: 0001-Resolves-rhbz-968892-force-render-full-grapheme-with.patch
+Patch24: 0001-Related-rhbz-968892-discard-impossible-languages-for.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/libreoffice
@@ -995,6 +996,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch21 -p1 -b .autosize-the-frame-direction-listbox.patch
 %patch22 -p1 -b .setting-max-line-count-should-allow-extra-values-to-.patch
 %patch23 -p1 -b .rhbz-968892-force-render-full-grapheme-with.patch
+%patch24 -p1 -b .rhbz-968892-discard-impossible-languages-for.patch
 
 # TODO: check this
 # these are horribly incomplete--empty translations and copied english
@@ -2060,6 +2062,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %changelog
 * Tue Jun 04 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.0.0-5.beta1
 - Resolves: rhbz#968892 block entire grapheme together for glyph fallback
+- Related: rhbz#968892 discard impossible languages for glyph fallback
 
 * Fri May 31 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.0.0-4.beta1
 - Resolves: rhbz#968976 fix dropdown list autosizing


More information about the scm-commits mailing list