summaryrefslogtreecommitdiff
path: root/svtools/source/misc/sampletext.cxx
diff options
context:
space:
mode:
authorMatthew J. Francis <mjay.francis@gmail.com>2014-08-31 11:28:44 +0800
committerCaolán McNamara <caolanm@redhat.com>2014-09-02 16:00:16 -0500
commitb6e581aec7f32fed8afeda1ca72ee613c6ac251a (patch)
treef445edd05e1174b727c6988bbcfeb2ccf97a61a2 /svtools/source/misc/sampletext.cxx
parent5fa84a49fe66a18f48a8b6e40bd6f94e979cb8df (diff)
fdo#82259 Hardcode script for "GB18030 Bitmap"
Change-Id: I3b3ad955f1793197e970c837ff53aa85a74b8cfb Reviewed-on: https://gerrit.libreoffice.org/11213 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools/source/misc/sampletext.cxx')
-rw-r--r--svtools/source/misc/sampletext.cxx34
1 files changed, 27 insertions, 7 deletions
diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx
index b7e416de8a6c..2800cc220e5e 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -13,6 +13,20 @@
#include <vcl/metric.hxx>
#include <i18nutil/unicode.hxx>
+// This should only be used when a commonly used font incorrectly declares its
+// coverage. If you add a font here, please leave a note explaining the issue
+// that caused it to be added
+static UScriptCode lcl_getHardCodedScriptNameForFont (const OutputDevice &rDevice)
+{
+ // As of OSX 10.9, the system font "GB18030 Bitmap" incorrectly declares
+ // that it only covers "Phoenician" when in fact it's a Chinese font.
+ if (rDevice.GetFont().GetName().equalsIgnoreAsciiCase("GB18030 Bitmap")) {
+ return USCRIPT_HAN;
+ }
+
+ return USCRIPT_INVALID_CODE;
+}
+
bool isOpenSymbolFont(const Font &rFont)
{
return rFont.GetName().equalsIgnoreAsciiCase("starsymbol") ||
@@ -1191,14 +1205,20 @@ OUString makeShortRepresentativeTextForSelectedFont(OutputDevice &rDevice)
aFontCapabilities.maUnicodeRange &= getCommonLatnSubsetMask();
- //If this font is probably tuned to display a single non-Latin
- //script and the font name is itself in Latin, then show a small
- //chunk of representative text for that script
- UScriptCode eScript = getScript(aFontCapabilities);
- if (eScript == USCRIPT_COMMON)
- return OUString();
+ UScriptCode eScript = lcl_getHardCodedScriptNameForFont (rDevice);
+
+ if (eScript == USCRIPT_INVALID_CODE) {
+
+ //If this font is probably tuned to display a single non-Latin
+ //script and the font name is itself in Latin, then show a small
+ //chunk of representative text for that script
+ eScript = getScript(aFontCapabilities);
+ if (eScript == USCRIPT_COMMON)
+ return OUString();
- eScript = attemptToDisambiguateHan(eScript, rDevice);
+ eScript = attemptToDisambiguateHan(eScript, rDevice);
+
+ }
OUString sSampleText = makeShortRepresentativeTextForScript(eScript);
bool bHasSampleTextGlyphs = (-1 == rDevice.HasGlyphs(rDevice.GetFont(), sSampleText));