bug 1012365 - workaround for Devanagari fonts that lack support for U+0972 on Android. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Mon, 02 Jun 2014 12:46:49 +0100
changeset 205374 52e25aa9d032e0b153728e32193c8b971f32c705
parent 205373 3813e66131ef67e803b8268f05b5e2b0af481c9d
child 205375 c4ca7aeb2eb43c8a694c6071a5a4b8125872eb15
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1012365
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1012365 - workaround for Devanagari fonts that lack support for U+0972 on Android. r=jdaggett
gfx/thebes/gfxFT2FontList.cpp
gfx/thebes/gfxHarfBuzzShaper.cpp
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -510,16 +510,25 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFo
                 if (hasGSUB && SupportsScriptInGSUB(sr->tags)) {
                     continue;
                 }
                 charmap->ClearRange(sr->rangeStart, sr->rangeEnd);
             }
         }
     }
 
+#ifdef MOZ_WIDGET_ANDROID
+    // Hack for the SamsungDevanagari font, bug 1012365:
+    // pretend the font supports U+0972.
+    if (!charmap->test(0x0972) &&
+        charmap->test(0x0905) && charmap->test(0x0945)) {
+        charmap->set(0x0972);
+    }
+#endif
+
     mHasCmapTable = NS_SUCCEEDED(rv);
     if (mHasCmapTable) {
         gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList();
         mCharacterMap = pfl->FindCharMap(charmap);
     } else {
         // if error occurred, initialize to null cmap
         mCharacterMap = new gfxCharacterMap();
     }
--- a/gfx/thebes/gfxHarfBuzzShaper.cpp
+++ b/gfx/thebes/gfxHarfBuzzShaper.cpp
@@ -790,16 +790,25 @@ HBUnicodeCompose(hb_unicode_funcs_t *ufu
 
 static hb_bool_t
 HBUnicodeDecompose(hb_unicode_funcs_t *ufuncs,
                    hb_codepoint_t      ab,
                    hb_codepoint_t     *a,
                    hb_codepoint_t     *b,
                    void               *user_data)
 {
+#ifdef MOZ_WIDGET_ANDROID
+    // Hack for the SamsungDevanagari font, bug 1012365:
+    // support U+0972 by decomposing it.
+    if (ab == 0x0972) {
+        *a = 0x0905;
+        *b = 0x0945;
+        return true;
+    }
+#endif
     return nsUnicodeNormalizer::DecomposeNonRecursively(ab, a, b);
 }
 
 static PLDHashOperator
 AddOpenTypeFeature(const uint32_t& aTag, uint32_t& aValue, void *aUserArg)
 {
     nsTArray<hb_feature_t>* features = static_cast<nsTArray<hb_feature_t>*> (aUserArg);