mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Bug 407415 - NaNs in gfx*Font with font-size:0 and font-size-adjust. r=roc a=schrep
This commit is contained in:
parent
05c8ea82dd
commit
70144e2d9f
@ -90,7 +90,7 @@ gfxAtsuiFont::gfxAtsuiFont(ATSUFontID fontID,
|
||||
const gfxFontStyle *fontStyle)
|
||||
: gfxFont(name, fontStyle),
|
||||
mFontStyle(fontStyle), mATSUFontID(fontID), mATSUStyle(nsnull),
|
||||
mHasMirroring(PR_FALSE), mHasMirroringLookedUp(PR_FALSE), mAdjustedSize(0)
|
||||
mHasMirroring(PR_FALSE), mHasMirroringLookedUp(PR_FALSE), mAdjustedSize(0.0f)
|
||||
{
|
||||
ATSFontRef fontRef = FMGetATSFontRefFromFont(fontID);
|
||||
|
||||
@ -128,7 +128,7 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
||||
};
|
||||
|
||||
gfxFloat size =
|
||||
PR_MAX(((mAdjustedSize != 0) ? mAdjustedSize : GetStyle()->size), 1.0f);
|
||||
PR_MAX(((mAdjustedSize != 0.0f) ? mAdjustedSize : GetStyle()->size), 1.0f);
|
||||
|
||||
//fprintf (stderr, "string: '%s', size: %f\n", NS_ConvertUTF16toUTF8(aString).get(), size);
|
||||
|
||||
@ -165,8 +165,8 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
||||
else
|
||||
mMetrics.xHeight = GetCharHeight('x');
|
||||
|
||||
if (mAdjustedSize == 0) {
|
||||
if (GetStyle()->sizeAdjust != 0) {
|
||||
if (mAdjustedSize == 0.0f) {
|
||||
if (mMetrics.xHeight != 0.0f && GetStyle()->sizeAdjust != 0.0f) {
|
||||
gfxFloat aspect = mMetrics.xHeight / size;
|
||||
mAdjustedSize = GetStyle()->GetAdjustedSize(aspect);
|
||||
InitMetrics(aFontID, aFontRef);
|
||||
|
@ -309,7 +309,7 @@ gfxPangoFont::RealizeFont(PRBool force)
|
||||
mPangoFontDesc = pango_font_description_new();
|
||||
|
||||
pango_font_description_set_family(mPangoFontDesc, NS_ConvertUTF16toUTF8(mName).get());
|
||||
gfxFloat size = mAdjustedSize ? mAdjustedSize : GetStyle()->size;
|
||||
gfxFloat size = mAdjustedSize != 0.0f ? mAdjustedSize : GetStyle()->size;
|
||||
pango_font_description_set_absolute_size(mPangoFontDesc, size * PANGO_SCALE);
|
||||
pango_font_description_set_style(mPangoFontDesc, ThebesStyleToPangoStyle(GetStyle()));
|
||||
pango_font_description_set_weight(mPangoFontDesc, ThebesStyleToPangoWeight(GetStyle()));
|
||||
@ -328,11 +328,11 @@ gfxPangoFont::RealizeFont(PRBool force)
|
||||
NS_ASSERTION(mHasMetrics == PR_FALSE, "throwing away our good metrics....");
|
||||
mHasMetrics = PR_FALSE;
|
||||
|
||||
if (mAdjustedSize != 0)
|
||||
if (mAdjustedSize != 0.0f)
|
||||
return;
|
||||
|
||||
mAdjustedSize = GetStyle()->size;
|
||||
if (mAdjustedSize == 0 || GetStyle()->sizeAdjust == 0)
|
||||
if (mAdjustedSize == 0.0f || GetStyle()->sizeAdjust == 0.0f)
|
||||
return;
|
||||
|
||||
gfxSize isz, lsz;
|
||||
|
@ -115,7 +115,7 @@ struct DCFromContext {
|
||||
|
||||
gfxWindowsFont::gfxWindowsFont(const nsAString& aName, const gfxFontStyle *aFontStyle)
|
||||
: gfxFont(aName, aFontStyle),
|
||||
mFont(nsnull), mAdjustedSize(0), mScriptCache(nsnull),
|
||||
mFont(nsnull), mAdjustedSize(0.0f), mScriptCache(nsnull),
|
||||
mFontFace(nsnull), mScaledFont(nsnull),
|
||||
mMetrics(nsnull)
|
||||
{
|
||||
@ -243,7 +243,7 @@ gfxWindowsFont::MakeHFONT()
|
||||
chosenWeight = baseWeight * 100;
|
||||
|
||||
mAdjustedSize = GetStyle()->size;
|
||||
if (GetStyle()->sizeAdjust > 0) {
|
||||
if (mMetrics->xHeight != 0.0f && GetStyle()->sizeAdjust > 0.0f) {
|
||||
if (!mFont) {
|
||||
FillLogFont(mAdjustedSize, chosenWeight);
|
||||
mFont = CreateFontIndirectW(&mLogFont);
|
||||
|
Loading…
Reference in New Issue
Block a user