void FontInstanceAdapter::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphID glyphs[]) const
{
    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;
			}
		}

        glyphs[out] = mapCharToGlyph(code, mapper);

		if (code >= 0x10000) {
			i += 1;
			glyphs[out += dir] = 0xFFFF;
		}
    }
}
Esempio n. 2
0
LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
{
    LEUnicode32 mappedChar = mapper->mapChar(ch);

    if (mappedChar == 0xFFFE || mappedChar == 0xFFFF ||
        mappedChar == 0x200C || mappedChar == 0x200D) {
        return 0xFFFF;
    }

    return mapCharToGlyph(mappedChar);
}
Esempio n. 3
0
LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const
{
    LEUnicode32 mappedChar = mapper->mapChar(ch);

    if (mappedChar == 0xFFFE || mappedChar == 0xFFFF) {
        return 0xFFFF;
    }

    if (filterZeroWidth && (mappedChar == 0x200C || mappedChar == 0x200D)) {
        return canDisplay(mappedChar)? 0x0001 : 0xFFFF;
    }

    return mapCharToGlyph(mappedChar);
}
Esempio n. 4
0
le_bool LEFontInstance::canDisplay(LEUnicode32 ch) const
{
    return LE_GET_GLYPH(mapCharToGlyph(ch)) != 0;
}
Esempio n. 5
0
LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
{
    return mapCharToGlyph(ch, mapper, TRUE);
}