57 } |
57 } |
58 |
58 |
59 void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, |
59 void CanonShaping::reorderMarks(const LEUnicode *inChars, le_int32 charCount, le_bool rightToLeft, |
60 LEUnicode *outChars, LEGlyphStorage &glyphStorage) |
60 LEUnicode *outChars, LEGlyphStorage &glyphStorage) |
61 { |
61 { |
62 const GlyphDefinitionTableHeader *gdefTable = (const GlyphDefinitionTableHeader *) glyphDefinitionTable; |
62 LEErrorCode success = LE_NO_ERROR; |
63 const ClassDefinitionTable *classTable = gdefTable->getMarkAttachClassDefinitionTable(); |
63 LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen); |
|
64 LEReferenceTo<ClassDefinitionTable> classTable = gdefTable->getMarkAttachClassDefinitionTable(gdefTable, success); |
64 le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount); |
65 le_int32 *combiningClasses = LE_NEW_ARRAY(le_int32, charCount); |
65 le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); |
66 le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount); |
66 LEErrorCode status = LE_NO_ERROR; |
|
67 le_int32 i; |
67 le_int32 i; |
68 |
68 |
69 for (i = 0; i < charCount; i += 1) { |
69 for (i = 0; i < charCount; i += 1) { |
70 combiningClasses[i] = classTable->getGlyphClass((LEGlyphID) inChars[i]); |
70 combiningClasses[i] = classTable->getGlyphClass(classTable, (LEGlyphID) inChars[i], success); |
71 indices[i] = i; |
71 indices[i] = i; |
72 } |
72 } |
73 |
73 |
74 for (i = 0; i < charCount; i += 1) { |
74 for (i = 0; i < charCount; i += 1) { |
75 if (combiningClasses[i] != 0) { |
75 if (combiningClasses[i] != 0) { |
94 |
94 |
95 for (i = 0; i < charCount; i += 1, out += dir) { |
95 for (i = 0; i < charCount; i += 1, out += dir) { |
96 le_int32 index = indices[i]; |
96 le_int32 index = indices[i]; |
97 |
97 |
98 outChars[i] = inChars[index]; |
98 outChars[i] = inChars[index]; |
99 glyphStorage.setCharIndex(out, index, status); |
99 glyphStorage.setCharIndex(out, index, success); |
100 } |
100 } |
101 |
101 |
102 LE_DELETE_ARRAY(indices); |
102 LE_DELETE_ARRAY(indices); |
103 LE_DELETE_ARRAY(combiningClasses); |
103 LE_DELETE_ARRAY(combiningClasses); |
104 } |
104 } |