bug 745261 - check calls to SetupCairoFont for failure. r=jdaggett

This commit is contained in:
Jonathan Kew 2012-04-17 09:50:26 +01:00
parent 4f680aaceb
commit c04607daca
3 changed files with 20 additions and 9 deletions

View File

@ -2786,12 +2786,13 @@ gfxGlyphExtents::GetTightGlyphExtentsAppUnits(gfxFont *aFont,
return false;
}
aFont->SetupCairoFont(aContext);
if (aFont->SetupCairoFont(aContext)) {
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
++gGlyphExtentsSetupLazyTight;
++gGlyphExtentsSetupLazyTight;
#endif
aFont->SetupGlyphExtents(aContext, aGlyphID, true, this);
entry = mTightGlyphExtents.GetEntry(aGlyphID);
aFont->SetupGlyphExtents(aContext, aGlyphID, true, this);
entry = mTightGlyphExtents.GetEntry(aGlyphID);
}
if (!entry) {
NS_WARNING("Could not get glyph extents");
return false;
@ -5453,8 +5454,11 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
PRUint32 glyphIndex = glyphData->GetSimpleGlyph();
if (!extents->IsGlyphKnown(glyphIndex)) {
if (!fontIsSetup) {
font->SetupCairoFont(aRefContext);
fontIsSetup = true;
if (!font->SetupCairoFont(aRefContext)) {
NS_WARNING("failed to set up font for glyph extents");
break;
}
fontIsSetup = true;
}
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
++gGlyphExtentsSetupEagerSimple;
@ -5475,7 +5479,10 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
PRUint32 glyphIndex = details->mGlyphID;
if (!extents->IsGlyphKnownWithTightExtents(glyphIndex)) {
if (!fontIsSetup) {
font->SetupCairoFont(aRefContext);
if (!font->SetupCairoFont(aRefContext)) {
NS_WARNING("failed to set up font for glyph extents");
break;
}
fontIsSetup = true;
}
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS

View File

@ -160,7 +160,9 @@ gfxGraphiteShaper::ShapeWord(gfxContext *aContext,
const PRUnichar *aText)
{
// some font back-ends require this in order to get proper hinted metrics
mFont->SetupCairoFont(aContext);
if (!mFont->SetupCairoFont(aContext)) {
return false;
}
mCallbackData.mContext = aContext;

View File

@ -855,7 +855,9 @@ gfxHarfBuzzShaper::ShapeWord(gfxContext *aContext,
const PRUnichar *aText)
{
// some font back-ends require this in order to get proper hinted metrics
mFont->SetupCairoFont(aContext);
if (!mFont->SetupCairoFont(aContext)) {
return false;
}
if (!mHBFace) {