[OS/2] Bug 490390: fix crash with broken Wingdings font, r=wuno@lsvw

This commit is contained in:
Peter Weilbacher 2009-04-29 01:10:56 +03:00
parent 859edfecf4
commit 5e65fbeecb

View File

@ -118,6 +118,11 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
return *mMetrics;
}
// whatever happens below, we can always create the metrics
mMetrics = new gfxFont::Metrics;
mMetrics->emHeight = GetStyle()->size;
mSpaceGlyph = 0;
FT_Face face = cairo_ft_scaled_font_lock_face(CairoScaledFont());
if (!face) {
// Abort here already, otherwise we crash in the following
@ -133,9 +138,6 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
return *mMetrics;
}
mMetrics = new gfxFont::Metrics;
mMetrics->emHeight = GetStyle()->size;
double emUnit = 1.0 * face->units_per_EM;
double xScale = face->size->metrics.x_ppem / emUnit;
double yScale = face->size->metrics.y_ppem / emUnit;