Bug 405393 - ZWNJ and ZWJ unicode characters are failing to render correctly. r=roc.

This commit is contained in:
karlt+@karlt.net 2007-12-18 13:50:03 -08:00
parent 0f1a979865
commit 6a3d8d8c9a

View File

@ -70,7 +70,6 @@
#include <cairo-ft.h>
#include <pango/pango.h>
#include <pango/pango-utils.h>
#include <pango/pangocairo.h>
#include <pango/pangofc-fontmap.h>
@ -90,7 +89,8 @@
#define PANGO_GLYPH_EMPTY ((PangoGlyph)0)
#endif
// For g a PangoGlyph,
#define IS_MISSING_GLYPH(g) (((g) & PANGO_GLYPH_UNKNOWN_FLAG) || (g) == PANGO_GLYPH_EMPTY)
#define IS_MISSING_GLYPH(g) ((g) & PANGO_GLYPH_UNKNOWN_FLAG)
#define IS_EMPTY_GLYPH(g) ((g) == PANGO_GLYPH_EMPTY)
static PangoLanguage *GetPangoLanguage(const nsACString& aLangGroup);
@ -394,7 +394,7 @@ gfxPangoFont::GetCharSize(char aChar, gfxSize& aInkSize, gfxSize& aLogSize,
*aGlyphID = 0;
if (glstr->num_glyphs == 1) {
PangoGlyph glyph = glstr->glyphs[0].glyph;
if (!IS_MISSING_GLYPH(glyph)) {
if (!IS_MISSING_GLYPH(glyph) && !IS_EMPTY_GLYPH(glyph)) {
*aGlyphID = glyph;
}
}
@ -1002,17 +1002,16 @@ gfxPangoFontGroup::SetGlyphs(gfxTextRun *aTextRun, gfxPangoFont *aFont,
return NS_ERROR_FAILURE;
}
} else {
gunichar ch = g_utf8_get_char(clusterUTF8);
do { // Does pango ever provide more than one glyph in the cluster
// if there is a missing glyph?
// behdad: yes
if (IS_MISSING_GLYPH(glyphs[glyphIndex].glyph)) {
if (pango_is_zero_width(ch)) {
// the zero width characters returns empty glyph ID at shaping,
// we should override it if the font has the character.
do {
if (IS_EMPTY_GLYPH(glyphs[glyphIndex].glyph)) {
// The zero width characters return empty glyph ID at
// shaping, we should override it.
glyphs[glyphIndex].glyph = aFont->GetGlyph(' ');
glyphs[glyphIndex].geometry.width = 0;
} else
} else if (IS_MISSING_GLYPH(glyphs[glyphIndex].glyph)) {
// Does pango ever provide more than one glyph in the
// cluster if there is a missing glyph?
// behdad: yes
haveMissingGlyph = PR_TRUE;
}
glyphIndex++;