mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1029307 - remove subscript/superscript metrics. r=heycam
This commit is contained in:
parent
c0310a0a41
commit
9beb5203b2
@ -316,8 +316,6 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption)
|
|||||||
fontMetrics.strikethroughPosition * mFUnitsConvFactor;
|
fontMetrics.strikethroughPosition * mFUnitsConvFactor;
|
||||||
mMetrics->strikeoutSize =
|
mMetrics->strikeoutSize =
|
||||||
fontMetrics.strikethroughThickness * mFUnitsConvFactor;
|
fontMetrics.strikethroughThickness * mFUnitsConvFactor;
|
||||||
mMetrics->superscriptOffset = 0;
|
|
||||||
mMetrics->subscriptOffset = 0;
|
|
||||||
|
|
||||||
SanitizeMetrics(mMetrics, GetFontEntry()->mIsBadUnderlineFont);
|
SanitizeMetrics(mMetrics, GetFontEntry()->mIsBadUnderlineFont);
|
||||||
|
|
||||||
@ -329,9 +327,8 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption)
|
|||||||
printf(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading);
|
printf(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading);
|
||||||
printf(" spaceWidth: %f aveCharWidth: %f zeroOrAve: %f xHeight: %f\n",
|
printf(" spaceWidth: %f aveCharWidth: %f zeroOrAve: %f xHeight: %f\n",
|
||||||
mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->xHeight);
|
mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->xHeight);
|
||||||
printf(" uOff: %f uSize: %f stOff: %f stSize: %f supOff: %f subOff: %f\n",
|
printf(" uOff: %f uSize: %f stOff: %f stSize: %f\n",
|
||||||
mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
|
mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize);
|
||||||
mMetrics->superscriptOffset, mMetrics->subscriptOffset);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ gfxFT2FontBase::GetMetrics()
|
|||||||
fprintf (stderr, " maxAscent: %f maxDescent: %f\n", mMetrics.maxAscent, mMetrics.maxDescent);
|
fprintf (stderr, " maxAscent: %f maxDescent: %f\n", mMetrics.maxAscent, mMetrics.maxDescent);
|
||||||
fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.externalLeading, mMetrics.internalLeading);
|
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, " 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
|
#endif
|
||||||
|
|
||||||
mHasMetrics = true;
|
mHasMetrics = true;
|
||||||
|
@ -67,8 +67,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
|||||||
aMetrics->zeroOrAveCharWidth = spaceWidth;
|
aMetrics->zeroOrAveCharWidth = spaceWidth;
|
||||||
const gfxFloat xHeight = 0.5 * emHeight;
|
const gfxFloat xHeight = 0.5 * emHeight;
|
||||||
aMetrics->xHeight = xHeight;
|
aMetrics->xHeight = xHeight;
|
||||||
aMetrics->superscriptOffset = xHeight;
|
|
||||||
aMetrics->subscriptOffset = xHeight;
|
|
||||||
const gfxFloat underlineSize = emHeight / 14.0;
|
const gfxFloat underlineSize = emHeight / 14.0;
|
||||||
aMetrics->underlineSize = underlineSize;
|
aMetrics->underlineSize = underlineSize;
|
||||||
aMetrics->underlineOffset = -underlineSize;
|
aMetrics->underlineOffset = -underlineSize;
|
||||||
@ -243,24 +241,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
|||||||
}
|
}
|
||||||
SnapLineToPixels(aMetrics->strikeoutOffset, aMetrics->strikeoutSize);
|
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;
|
aMetrics->maxHeight = aMetrics->maxAscent + aMetrics->maxDescent;
|
||||||
|
|
||||||
// Make the line height an integer number of pixels so that lines will be
|
// Make the line height an integer number of pixels so that lines will be
|
||||||
|
@ -4597,8 +4597,6 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
|
|||||||
// this should always be present in any valid OS/2 of any version
|
// this should always be present in any valid OS/2 of any version
|
||||||
if (len >= offsetof(OS2Table, sTypoLineGap) + sizeof(int16_t)) {
|
if (len >= offsetof(OS2Table, sTypoLineGap) + sizeof(int16_t)) {
|
||||||
SET_SIGNED(aveCharWidth, os2->xAvgCharWidth);
|
SET_SIGNED(aveCharWidth, os2->xAvgCharWidth);
|
||||||
SET_SIGNED(subscriptOffset, os2->ySubscriptYOffset);
|
|
||||||
SET_SIGNED(superscriptOffset, os2->ySuperscriptYOffset);
|
|
||||||
SET_SIGNED(strikeoutSize, os2->yStrikeoutSize);
|
SET_SIGNED(strikeoutSize, os2->yStrikeoutSize);
|
||||||
SET_SIGNED(strikeoutOffset, os2->yStrikeoutPosition);
|
SET_SIGNED(strikeoutOffset, os2->yStrikeoutPosition);
|
||||||
|
|
||||||
@ -4660,13 +4658,6 @@ void gfxFont::CalculateDerivedMetrics(Metrics& aMetrics)
|
|||||||
aMetrics.maxAdvance = aMetrics.aveCharWidth;
|
aMetrics.maxAdvance = aMetrics.aveCharWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aMetrics.subscriptOffset) {
|
|
||||||
aMetrics.subscriptOffset = aMetrics.xHeight;
|
|
||||||
}
|
|
||||||
if (!aMetrics.superscriptOffset) {
|
|
||||||
aMetrics.superscriptOffset = aMetrics.xHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aMetrics.strikeoutOffset) {
|
if (!aMetrics.strikeoutOffset) {
|
||||||
aMetrics.strikeoutOffset = aMetrics.xHeight * 0.5;
|
aMetrics.strikeoutOffset = aMetrics.xHeight * 0.5;
|
||||||
}
|
}
|
||||||
@ -4685,19 +4676,6 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont)
|
|||||||
return;
|
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->underlineSize = std::max(1.0, aMetrics->underlineSize);
|
||||||
aMetrics->strikeoutSize = std::max(1.0, aMetrics->strikeoutSize);
|
aMetrics->strikeoutSize = std::max(1.0, aMetrics->strikeoutSize);
|
||||||
|
|
||||||
|
@ -1658,8 +1658,6 @@ public:
|
|||||||
// Font metrics
|
// Font metrics
|
||||||
struct Metrics {
|
struct Metrics {
|
||||||
gfxFloat xHeight;
|
gfxFloat xHeight;
|
||||||
gfxFloat superscriptOffset;
|
|
||||||
gfxFloat subscriptOffset;
|
|
||||||
gfxFloat strikeoutSize;
|
gfxFloat strikeoutSize;
|
||||||
gfxFloat strikeoutOffset;
|
gfxFloat strikeoutOffset;
|
||||||
gfxFloat underlineSize;
|
gfxFloat underlineSize;
|
||||||
|
@ -247,9 +247,6 @@ gfxGDIFont::Initialize()
|
|||||||
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
|
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
|
||||||
|
|
||||||
if (0 < GetOutlineTextMetrics(dc.GetDC(), sizeof(oMetrics), &oMetrics)) {
|
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->strikeoutSize = (double)oMetrics.otmsStrikeoutSize;
|
||||||
mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition;
|
mMetrics->strikeoutOffset = (double)oMetrics.otmsStrikeoutPosition;
|
||||||
mMetrics->underlineSize = (double)oMetrics.otmsUnderscoreSize;
|
mMetrics->underlineSize = (double)oMetrics.otmsUnderscoreSize;
|
||||||
@ -288,8 +285,6 @@ gfxGDIFont::Initialize()
|
|||||||
|
|
||||||
mMetrics->xHeight =
|
mMetrics->xHeight =
|
||||||
ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
ROUND((float)metrics.tmAscent * DEFAULT_XHEIGHT_FACTOR);
|
||||||
mMetrics->superscriptOffset = mMetrics->xHeight;
|
|
||||||
mMetrics->subscriptOffset = mMetrics->xHeight;
|
|
||||||
mMetrics->strikeoutSize = 1;
|
mMetrics->strikeoutSize = 1;
|
||||||
mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight
|
mMetrics->strikeoutOffset = ROUND(mMetrics->xHeight * 0.5f); // 50% of xHeight
|
||||||
mMetrics->underlineSize = 1;
|
mMetrics->underlineSize = 1;
|
||||||
@ -394,9 +389,8 @@ gfxGDIFont::Initialize()
|
|||||||
printf(" maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance);
|
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(" internalLeading: %f externalLeading: %f\n", mMetrics->internalLeading, mMetrics->externalLeading);
|
||||||
printf(" spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics->spaceWidth, mMetrics->aveCharWidth, mMetrics->xHeight);
|
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",
|
printf(" uOff: %f uSize: %f stOff: %f stSize: %f\n",
|
||||||
mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
|
mMetrics->underlineOffset, mMetrics->underlineSize, mMetrics->strikeoutOffset, mMetrics->strikeoutSize);
|
||||||
mMetrics->superscriptOffset, mMetrics->subscriptOffset);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ gfxMacFont::InitMetrics()
|
|||||||
fprintf (stderr, " maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance);
|
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, " 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, " 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user