ICU-5309 Need to filter ZWJ/ZWNJ in LEFontInstance:MapCharToGlyph 'cause need to be able call canDisplay.
X-SVN-Rev: 20929
This commit is contained in:
parent
2a91ca5374
commit
0baac6e262
@ -28,7 +28,6 @@ class DefaultCharMapper : public UMemory, public LECharMapper
|
||||
private:
|
||||
le_bool fFilterControls;
|
||||
le_bool fMirror;
|
||||
le_bool fFilterZeroWidth;
|
||||
|
||||
static const LEUnicode32 controlChars[];
|
||||
|
||||
@ -40,8 +39,8 @@ private:
|
||||
static const le_int32 mirroredCharsCount;
|
||||
|
||||
public:
|
||||
DefaultCharMapper(le_bool filterControls, le_bool mirror, le_bool filterZeroWidth)
|
||||
: fFilterControls(filterControls), fMirror(mirror), fFilterZeroWidth(filterZeroWidth)
|
||||
DefaultCharMapper(le_bool filterControls, le_bool mirror)
|
||||
: fFilterControls(filterControls), fMirror(mirror)
|
||||
{
|
||||
// nothing
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int
|
||||
}
|
||||
|
||||
void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count,
|
||||
le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const
|
||||
le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const
|
||||
{
|
||||
le_int32 i, out = 0, dir = 1;
|
||||
|
||||
@ -68,7 +68,7 @@ void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
|
||||
}
|
||||
}
|
||||
|
||||
glyphStorage[out] = mapCharToGlyph(code, mapper);
|
||||
glyphStorage[out] = mapCharToGlyph(code, mapper, filterZeroWidth);
|
||||
|
||||
if (code >= 0x10000) {
|
||||
i += 1;
|
||||
@ -78,21 +78,21 @@ void LEFontInstance::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset,
|
||||
}
|
||||
|
||||
LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
|
||||
{
|
||||
return mapCharToGlyph(ch, mapper, TRUE);
|
||||
}
|
||||
|
||||
LEGlyphID LEFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const
|
||||
{
|
||||
LEUnicode32 mappedChar = mapper->mapChar(ch);
|
||||
|
||||
if (mappedChar == 0xFFFE || mappedChar == 0xFFFF ||
|
||||
mappedChar == 0x200C || mappedChar == 0x200D) {
|
||||
if (mappedChar == 0xFFFE || mappedChar == 0xFFFF) {
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO: figure out if we still need to do this now that DefaultCharMapper
|
||||
// does the filtering... (and why did we call canDisplay at all?)
|
||||
if (filterZeroWidth && (mappedChar == 0x200C || mappedChar == 0x200D)) {
|
||||
return canDisplay(mappedChar)? 0x0001 : 0xFFFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mapCharToGlyph(mappedChar);
|
||||
}
|
||||
|
@ -209,13 +209,31 @@ public:
|
||||
* @param count - the number of characters
|
||||
* @param reverse - if <code>TRUE</code>, store the glyph indices in reverse order.
|
||||
* @param mapper - the character mapper.
|
||||
* @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
|
||||
* @param glyphStorage - the object which contains the output glyph array
|
||||
*
|
||||
* @see LECharMapper
|
||||
*
|
||||
* @draft ICU 3.6
|
||||
*/
|
||||
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphStorage &glyphStorage) const;
|
||||
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, le_bool filterZeroWidth, LEGlyphStorage &glyphStorage) const;
|
||||
|
||||
/**
|
||||
* This method maps a single character to a glyph index, using the
|
||||
* font's character to glyph map. The default implementation of this
|
||||
* method calls the mapper, and then calls <code>mapCharToGlyph(mappedCh)</code>.
|
||||
*
|
||||
* @param ch - the character
|
||||
* @param mapper - the character mapper
|
||||
* @param filterZeroWidth - <code>TRUE</code> if ZWJ / ZWNJ characters should map to a glyph w/ no contours.
|
||||
*
|
||||
* @return the glyph index
|
||||
*
|
||||
* @see LECharMapper
|
||||
*
|
||||
* @draft ICU 3.6
|
||||
*/
|
||||
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
|
||||
|
||||
/**
|
||||
* This method maps a single character to a glyph index, using the
|
||||
|
@ -61,10 +61,6 @@ LEUnicode32 DefaultCharMapper::mapChar(LEUnicode32 ch) const
|
||||
}
|
||||
}
|
||||
|
||||
if (fFilterZeroWidth && (ch == 0x200C || ch == 0x200D)) {
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
@ -395,9 +391,9 @@ void LayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le
|
||||
|
||||
glyphStorage.allocateGlyphArray(count, reverse, success);
|
||||
|
||||
DefaultCharMapper charMapper(TRUE, mirror, fFilterZeroWidth);
|
||||
DefaultCharMapper charMapper(TRUE, mirror);
|
||||
|
||||
fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, glyphStorage);
|
||||
fFontInstance->mapCharsToGlyphs(chars, offset, count, reverse, &charMapper, fFilterZeroWidth, glyphStorage);
|
||||
}
|
||||
|
||||
// Input: characters, font?
|
||||
|
@ -360,6 +360,13 @@ le_int32 PortableFontInstance::getLeading() const
|
||||
return fLeading;
|
||||
}
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
LEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const
|
||||
{
|
||||
return LEFontInstance::mapCharToGlyph(ch, mapper, filterZeroWidth);
|
||||
}
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
LEGlyphID PortableFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
|
||||
|
@ -87,6 +87,10 @@ public:
|
||||
|
||||
virtual le_int32 getLeading() const;
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
|
||||
|
@ -86,6 +86,13 @@ le_int32 SimpleFontInstance::getLeading() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
LEGlyphID SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const
|
||||
{
|
||||
return LEFontInstance::mapCharToGlyph(ch, mapper, filterZeroWidth);
|
||||
}
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
LEGlyphID SimpleFontInstance::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
|
||||
|
@ -45,6 +45,10 @@ public:
|
||||
|
||||
virtual le_int32 getLeading() const;
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
|
||||
|
||||
// We really want to inherit this method from the superclass, but some compilers
|
||||
// issue a warning if we don't implement it...
|
||||
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
|
||||
|
Loading…
Reference in New Issue
Block a user