summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-4.2.1-PATCHES/patch-23-fix-JK-GlyphPos
blob: 192e6f8462780298914e458eb56b28de72597a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff -ur icu-4.2.1.orig/source/layout/OpenTypeLayoutEngine.cpp icu-4.2.1/source/layout/OpenTypeLayoutEngine.cpp
--- icu-4.2.1.orig/source/layout/OpenTypeLayoutEngine.cpp	2009-10-23 00:04:31.000000000 +0200
+++ icu-4.2.1/source/layout/OpenTypeLayoutEngine.cpp	2009-10-23 00:09:47.000000000 +0200
@@ -96,8 +96,10 @@
     setScriptAndLanguageTags();
 
     fGDEFTable = (const GlyphDefinitionTableHeader *) getFontTable(gdefTableTag);
-    
-    if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) {
+   
+// JK patch, 2008-05-30 - see Sinhala bug report and LKLUG font
+//    if (gposTable != NULL && gposTable->coversScriptAndLanguage(fScriptTag, fLangSysTag)) {
+    if (gposTable != NULL && gposTable->coversScript(fScriptTag)) {
         fGPOSTable = gposTable;
     }
 }
@@ -193,8 +195,16 @@
             return 0;
         }
 
+        if (LE_FAILURE(success)) {
+            LE_DELETE_ARRAY(outChars);
+            return 0;
+        }
+
         CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, outChars, glyphStorage);
     }
+    if (LE_FAILURE(success)) {
+        return 0;
+    }
 
     glyphStorage.allocateGlyphArray(count, rightToLeft, success);
     glyphStorage.allocateAuxData(success);
@@ -333,8 +343,10 @@
     }
 
     le_int32 glyphCount = glyphStorage.getGlyphCount();
+    if (glyphCount == 0)
+        return;
 
-    if (glyphCount > 0 && fGPOSTable != NULL) {
+    if (fGPOSTable != NULL) {
         GlyphPositionAdjustments *adjustments = new GlyphPositionAdjustments(glyphCount);
         le_int32 i;
 
@@ -401,6 +413,10 @@
 
         delete adjustments;
     }
+    else {
+        // if there was no GPOS table, maybe there's non-OpenType kerning we can use
+        LayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
+    }
 
     LEGlyphID zwnj  = fFontInstance->mapCharToGlyph(0x200C);