b=455647 garbage Indic characters on parts of some English webpages. r=pavlov
--- a/gfx/thebes/src/gfxFont.cpp
+++ b/gfx/thebes/src/gfxFont.cpp
@@ -2218,16 +2218,22 @@ gfxTextRun::SortGlyphRuns()
// Now copy back, coalescing adjacent glyph runs that have the same font
mGlyphRuns.Clear();
PRUint32 i;
for (i = 0; i < runs.Length(); ++i) {
// a GlyphRun with the same font as the previous GlyphRun can just
// be skipped; the last GlyphRun will cover its character range.
if (i == 0 || runs[i].mFont != runs[i - 1].mFont) {
mGlyphRuns.AppendElement(runs[i]);
+ // If two fonts have the same character offset, Sort() will have
+ // randomized the order.
+ NS_ASSERTION(i == 0 ||
+ runs[i].mCharacterOffset !=
+ runs[i - 1].mCharacterOffset,
+ "Two fonts for the same run, glyph indices may not match the font");
}
}
}
PRUint32
gfxTextRun::CountMissingGlyphs()
{
PRUint32 i;
--- a/gfx/thebes/src/gfxPangoFonts.cpp
+++ b/gfx/thebes/src/gfxPangoFonts.cpp
@@ -2216,17 +2216,17 @@ gfxPangoFontGroup::CreateGlyphRunsItemiz
length -= aUTF8HeaderLen - offset;
offset = aUTF8HeaderLen;
}
gfxFcFont *font =
gfxPangoFcFont::GfxFont(GFX_PANGO_FC_FONT(item->analysis.font));
- nsresult rv = aTextRun->AddGlyphRun(font, utf16Offset, PR_TRUE);
+ nsresult rv = aTextRun->AddGlyphRun(font, utf16Offset);
if (NS_FAILED(rv)) {
NS_ERROR("AddGlyphRun Failed");
goto out;
}
PRUint32 spaceWidth =
moz_pango_units_from_double(font->GetMetrics().spaceWidth);
@@ -2249,18 +2249,16 @@ gfxPangoFontGroup::CreateGlyphRunsItemiz
gint len = p - text;
pango_shape(text, len, &item->analysis, glyphString);
SetupClusterBoundaries(aTextRun, text, len, utf16Offset, &item->analysis);
SetGlyphs(aTextRun, text, len, &utf16Offset, glyphString, spaceWidth, PR_FALSE);
}
}
- aTextRun->SortGlyphRuns();
-
out:
if (glyphString)
pango_glyph_string_free(glyphString);
for (pos = items; pos; pos = pos->next)
pango_item_free((PangoItem *)pos->data);
if (items)