bug 553963 - part 2 - make gfxFont handle text-shaping failure more robustly. r=roc

This commit is contained in:
Jonathan Kew 2010-08-11 17:52:23 +01:00
parent c8f4d990c1
commit ab84e170d2

View File

@ -2235,17 +2235,19 @@ gfxFontGroup::InitTextRun(gfxContext *aContext,
PRUint32 matchedLength = range.Length();
gfxFont *matchedFont = (range.font ? range.font.get() : nsnull);
if (matchedFont) {
// create the glyph run for this range
aTextRun->AddGlyphRun(matchedFont, runStart, (matchedLength > 0));
aTextRun->AddGlyphRun(matchedFont ? matchedFont : mainFont,
runStart, (matchedLength > 0));
if (matchedFont) {
// do glyph layout and record the resulting positioned glyphs
matchedFont->InitTextRun(aContext, aTextRun, aString,
runStart, matchedLength, aRunScript);
} else {
// create the glyph run before calling SetMissing Glyph
aTextRun->AddGlyphRun(mainFont, runStart, matchedLength);
if (!matchedFont->InitTextRun(aContext, aTextRun, aString,
runStart, matchedLength,
aRunScript)) {
// glyph layout failed! treat as missing glyphs
matchedFont = nsnull;
}
}
if (!matchedFont) {
for (PRUint32 index = runStart; index < runStart + matchedLength; index++) {
// Record the char code so we can draw a box with the Unicode value
if (NS_IS_HIGH_SURROGATE(aString[index]) &&