Logo Search packages:      
Sourcecode: icu version File versions  Download package

void LEFontInstance::mapCharsToGlyphs ( const LEUnicode  chars[],
le_int32  offset,
le_int32  count,
le_bool  reverse,
const LECharMapper mapper,
le_bool  filterZeroWidth,
LEGlyphStorage glyphStorage 
) const [virtual]

This method maps an array of character codes to an array of glyph indices, using the font's character to glyph map.

The default implementation iterates over all of the characters and calls mapCharToGlyph(ch, mapper) on each one. It also handles surrogate characters, storing the glyph ID for the high surrogate, and a deleted glyph (0xFFFF) for the low surrogate.

Most sublcasses will not need to implement this method.

Parameters:
chars - the character array
offset - the index of the first character
count - the number of characters
reverse - if TRUE, store the glyph indices in reverse order.
mapper - the character mapper.
filterZeroWidth - TRUE if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
glyphStorage - the object which contains the output glyph array
See also:
LECharMapper
ICU 3.6

Definition at line 49 of file LEFontInstance.cpp.

References mapCharToGlyph().

Referenced by LayoutEngine::mapCharsToGlyphs().

{
    le_int32 i, out = 0, dir = 1;

    if (reverse) {
        out = count - 1;
        dir = -1;
    }

    for (i = offset; i < offset + count; i += 1, out += dir) {
        LEUnicode16 high = chars[i];
        LEUnicode32 code = high;

        if (i < offset + count - 1 && high >= 0xD800 && high <= 0xDBFF) {
            LEUnicode16 low = chars[i + 1];

            if (low >= 0xDC00 && low <= 0xDFFF) {
                code = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
            }
        }

        glyphStorage[out] = mapCharToGlyph(code, mapper, filterZeroWidth);

        if (code >= 0x10000) {
            i += 1;
            glyphStorage[out += dir] = 0xFFFF;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index