bug 751129 - ensure the font list is updated if necessary before accessing metrics. r=roc

This commit is contained in:
Jonathan Kew 2012-05-03 08:56:26 +01:00
parent 065e1ea766
commit c48dacae61
2 changed files with 2 additions and 0 deletions

View File

@ -2972,6 +2972,7 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
processor.mPt.x -= anchorX * totalWidth;
// offset pt.y based on text baseline
processor.mFontgrp->UpdateFontList(); // ensure user font generation is current
NS_ASSERTION(processor.mFontgrp->FontListLength()>0, "font group contains no fonts");
const gfxFont::Metrics& fontMetrics = processor.mFontgrp->GetFontAt(0)->GetMetrics();

View File

@ -3282,6 +3282,7 @@ nsCanvasRenderingContext2DAzure::DrawOrMeasureText(const nsAString& aRawText,
processor.mPt.x -= anchorX * totalWidth;
// offset pt.y based on text baseline
processor.mFontgrp->UpdateFontList(); // ensure user font generation is current
NS_ASSERTION(processor.mFontgrp->FontListLength()>0, "font group contains no fonts");
const gfxFont::Metrics& fontMetrics = processor.mFontgrp->GetFontAt(0)->GetMetrics();