diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index 51c086c8466..66f9cdd9cf8 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -316,8 +316,6 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption) fontMetrics.strikethroughPosition * mFUnitsConvFactor; mMetrics->strikeoutSize = fontMetrics.strikethroughThickness * mFUnitsConvFactor; - mMetrics->superscriptOffset = 0; - mMetrics->subscriptOffset = 0; SanitizeMetrics(mMetrics, GetFontEntry()->mIsBadUnderlineFont); @@ -329,9 +327,8 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption) printf(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading); printf(" spaceWidth: %f aveCharWidth: %f zeroOrAve: %f xHeight: %f\n", mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->xHeight); - printf(" uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n", - mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize, - mMetrics->superscriptOffset, mMetrics->subscriptOffset); + printf(" uOff: %f uSize: %f stOff: %f stSize: %f\n", + mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize); #endif } diff --git a/gfx/thebes/gfxFT2FontBase.cpp b/gfx/thebes/gfxFT2FontBase.cpp index 3755b5554bb..07c4aea861e 100644 --- a/gfx/thebes/gfxFT2FontBase.cpp +++ b/gfx/thebes/gfxFT2FontBase.cpp @@ -133,7 +133,7 @@ gfxFT2FontBase::GetMetrics() fprintf (stderr, " maxAscent: %f maxDescent: %f\n", mMetrics.maxAscent, mMetrics.maxDescent); fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.externalLeading, mMetrics.internalLeading); fprintf (stderr, " spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight); - fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f suOff: %f suSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize, mMetrics.superscriptOffset, mMetrics.subscriptOffset); + fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize); #endif mHasMetrics = true; diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp index b2aace4f92b..cd202fa6cd4 100644 --- a/gfx/thebes/gfxFT2Utils.cpp +++ b/gfx/thebes/gfxFT2Utils.cpp @@ -67,8 +67,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, aMetrics->zeroOrAveCharWidth = spaceWidth; const gfxFloat xHeight = 0.5 * emHeight; aMetrics->xHeight = xHeight; - aMetrics->superscriptOffset = xHeight; - aMetrics->subscriptOffset = xHeight; const gfxFloat underlineSize = emHeight / 14.0; aMetrics->underlineSize = underlineSize; aMetrics->underlineOffset = -underlineSize; @@ -243,24 +241,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, } SnapLineToPixels(aMetrics->strikeoutOffset, aMetrics->strikeoutSize); - if (os2 && os2->ySuperscriptYOffset) { - gfxFloat val = ScaleRoundDesignUnits(os2->ySuperscriptYOffset, - ftMetrics.y_scale); - aMetrics->superscriptOffset = std::max(1.0, val); - } else { - aMetrics->superscriptOffset = aMetrics->xHeight; - } - - if (os2 && os2->ySubscriptYOffset) { - gfxFloat val = ScaleRoundDesignUnits(os2->ySubscriptYOffset, - ftMetrics.y_scale); - // some fonts have the incorrect sign. - val = fabs(val); - aMetrics->subscriptOffset = std::max(1.0, val); - } else { - aMetrics->subscriptOffset = aMetrics->xHeight; - } - aMetrics->maxHeight = aMetrics->maxAscent + aMetrics->maxDescent; // Make the line height an integer number of pixels so that lines will be diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 4a584d1b86e..77d7c923b9f 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -4597,8 +4597,6 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics) // this should always be present in any valid OS/2 of any version if (len >= offsetof(OS2Table, sTypoLineGap) + sizeof(int16_t)) { SET_SIGNED(aveCharWidth, os2->xAvgCharWidth); - SET_SIGNED(subscriptOffset, os2->ySubscriptYOffset); - SET_SIGNED(superscriptOffset, os2->ySuperscriptYOffset); SET_SIGNED(strikeoutSize, os2->yStrikeoutSize); SET_SIGNED(strikeoutOffset, os2->yStrikeoutPosition); @@ -4660,13 +4658,6 @@ void gfxFont::CalculateDerivedMetrics(Metrics& aMetrics) aMetrics.maxAdvance = aMetrics.aveCharWidth; } - if (!aMetrics.subscriptOffset) { - aMetrics.subscriptOffset = aMetrics.xHeight; - } - if (!aMetrics.superscriptOffset) { - aMetrics.superscriptOffset = aMetrics.xHeight; - } - if (!aMetrics.strikeoutOffset) { aMetrics.strikeoutOffset = aMetrics.xHeight * 0.5; } @@ -4685,19 +4676,6 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont) return; } - // MS (P)Gothic and MS (P)Mincho are not having suitable values in their super script offset. - // If the values are not suitable, we should use x-height instead of them. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=353632 - if (aMetrics->superscriptOffset <= 0 || - aMetrics->superscriptOffset >= aMetrics->maxAscent) { - aMetrics->superscriptOffset = aMetrics->xHeight; - } - // And also checking the case of sub script offset. The old gfx for win has checked this too. - if (aMetrics->subscriptOffset <= 0 || - aMetrics->subscriptOffset >= aMetrics->maxAscent) { - aMetrics->subscriptOffset = aMetrics->xHeight; - } - aMetrics->underlineSize = std::max(1.0, aMetrics->underlineSize); aMetrics->strikeoutSize = std::max(1.0, aMetrics->strikeoutSize); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 60c688e6f05..2138f2f857b 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1658,8 +1658,6 @@ public: // Font metrics struct Metrics { gfxFloat xHeight; - gfxFloat superscriptOffset; - gfxFloat subscriptOffset; gfxFloat strikeoutSize; gfxFloat strikeoutOffset; gfxFloat underlineSize; diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index 63ac41d91eb..e5aedc9dcac 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -247,9 +247,6 @@ gfxGDIFont::Initialize() TEXTMETRIC& metrics = oMetrics.otmTextMetrics; if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) { - mMetrics->superscriptOffset = (double)oMetrics.otmptSuperscriptOffset.y; - // Some fonts have wrong sign on their subscript offset, bug 410917. - mMetrics->subscriptOffset = fabs((double)oMetrics.otmptSubscriptOffset.y); mMetrics->strikeoutSize = (double)oMetrics.otmsStrikeoutSize; mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition; mMetrics->underlineSize = (double)oMetrics.otmsUnderscoreSize; @@ -288,8 +285,6 @@ gfxGDIFont::Initialize() mMetrics->xHeight = ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR); - mMetrics->superscriptOffset = mMetrics->xHeight; - mMetrics->subscriptOffset = mMetrics->xHeight; mMetrics->strikeoutSize = 1; mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight mMetrics->underlineSize = 1; @@ -394,9 +389,8 @@ gfxGDIFont::Initialize() printf(" maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance); printf(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading); printf(" spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->xHeight); - printf(" uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n", - mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize, - mMetrics->superscriptOffset, mMetrics->subscriptOffset); + printf(" uOff: %f uSize: %f stOff: %f stSize: %f\n", + mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize); #endif } diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 4c1a1571a11..bf70a5637c1 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -332,7 +332,7 @@ gfxMacFont::InitMetrics() fprintf (stderr, " maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance); fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.internalLeading, mMetrics.externalLeading); fprintf (stderr, " spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight); - fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize, mMetrics.superscriptOffset, mMetrics.subscriptOffset); + fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize); #endif }