diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 8058dcaf00e..a2adec70086 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -1859,13 +1859,13 @@ gfxFont::DrawEmphasisMarks(gfxTextRun* aShapedText, gfxPoint* aPt, gfxFloat& inlineCoord = aParams.isVertical ? aPt->y : aPt->x; uint32_t markLength = aParams.mark->GetLength(); - gfxFloat clusterStart = NAN; + gfxFloat clusterStart = -INFINITY; bool shouldDrawEmphasisMark = false; for (uint32_t i = 0, idx = aOffset; i < aCount; ++i, ++idx) { if (aParams.spacing) { inlineCoord += aParams.direction * aParams.spacing[i].mBefore; } - if (aShapedText->IsClusterStart(idx)) { + if (aShapedText->IsClusterStart(idx) || clusterStart == -INFINITY) { clusterStart = inlineCoord; } if (aShapedText->CharMayHaveEmphasisMark(idx)) { @@ -1874,7 +1874,6 @@ gfxFont::DrawEmphasisMarks(gfxTextRun* aShapedText, gfxPoint* aPt, inlineCoord += aParams.direction * aShapedText->GetAdvanceForGlyph(idx); if (shouldDrawEmphasisMark && (i + 1 == aCount || aShapedText->IsClusterStart(idx + 1))) { - MOZ_ASSERT(!std::isnan(clusterStart), "Should have cluster start"); gfxFloat clusterAdvance = inlineCoord - clusterStart; // Move the coord backward to get the needed start point. gfxFloat delta = (clusterAdvance + aParams.advance) / 2;