285 // in the state table!
286 return FALSE;
287 }
288 }
289
290 le_int32 ThaiShaping::compose(const LEUnicode *input, le_int32 offset, le_int32 charCount, le_uint8 glyphSet,
291 LEUnicode errorChar, LEUnicode *output, LEGlyphStorage &glyphStorage)
292 {
293 le_uint8 state = 0;
294 le_int32 inputIndex;
295 le_int32 outputIndex = 0;
296 le_uint8 conState = 0xFF;
297 le_int32 conInput = -1;
298 le_int32 conOutput = -1;
299
300 for (inputIndex = 0; inputIndex < charCount; inputIndex += 1) {
301 LEUnicode ch = input[inputIndex + offset];
302 le_uint8 charClass;
303
304 // Decompose SARA AM into NIKHAHIT + SARA AA
305 if (ch == CH_SARA_AM && isLegalHere(ch, state)) {
306 outputIndex = conOutput;
307 state = getNextState(CH_NIKHAHIT, conState, inputIndex, glyphSet, errorChar, charClass,
308 output, glyphStorage, outputIndex);
309
310 for (int j = conInput + 1; j < inputIndex; j += 1) {
311 ch = input[j + offset];
312 state = getNextState(ch, state, j, glyphSet, errorChar, charClass,
313 output, glyphStorage, outputIndex);
314 }
315
316 ch = CH_SARA_AA;
317 }
318
319 state = getNextState(ch, state, inputIndex, glyphSet, errorChar, charClass,
320 output, glyphStorage, outputIndex);
321
322 if (charClass >= CON && charClass <= COD) {
323 conState = state;
324 conInput = inputIndex;
325 conOutput = outputIndex;
|
285 // in the state table!
286 return FALSE;
287 }
288 }
289
290 le_int32 ThaiShaping::compose(const LEUnicode *input, le_int32 offset, le_int32 charCount, le_uint8 glyphSet,
291 LEUnicode errorChar, LEUnicode *output, LEGlyphStorage &glyphStorage)
292 {
293 le_uint8 state = 0;
294 le_int32 inputIndex;
295 le_int32 outputIndex = 0;
296 le_uint8 conState = 0xFF;
297 le_int32 conInput = -1;
298 le_int32 conOutput = -1;
299
300 for (inputIndex = 0; inputIndex < charCount; inputIndex += 1) {
301 LEUnicode ch = input[inputIndex + offset];
302 le_uint8 charClass;
303
304 // Decompose SARA AM into NIKHAHIT + SARA AA
305 if (ch == CH_SARA_AM && isLegalHere(ch, state) && conState < stateCount) {
306 outputIndex = conOutput;
307 state = getNextState(CH_NIKHAHIT, conState, inputIndex, glyphSet, errorChar, charClass,
308 output, glyphStorage, outputIndex);
309
310 for (int j = conInput + 1; j < inputIndex; j += 1) {
311 ch = input[j + offset];
312 state = getNextState(ch, state, j, glyphSet, errorChar, charClass,
313 output, glyphStorage, outputIndex);
314 }
315
316 ch = CH_SARA_AA;
317 }
318
319 state = getNextState(ch, state, inputIndex, glyphSet, errorChar, charClass,
320 output, glyphStorage, outputIndex);
321
322 if (charClass >= CON && charClass <= COD) {
323 conState = state;
324 conInput = inputIndex;
325 conOutput = outputIndex;
|