зеркало из https://github.com/mozilla/pjs.git
Back out 0b1995eab10f due to mochitest failures on at least Windows. (Bug 363706)
This commit is contained in:
Родитель
6dfe3bef4e
Коммит
a8e590e3cb
|
@ -415,9 +415,6 @@ public:
|
|||
|
||||
gfxFloat aveCharWidth;
|
||||
gfxFloat spaceWidth;
|
||||
gfxFloat zeroOrAveCharWidth; // width of '0', or if there is
|
||||
// no '0' glyph in this font,
|
||||
// equal to .aveCharWidth
|
||||
};
|
||||
virtual const gfxFont::Metrics& GetMetrics() = 0;
|
||||
|
||||
|
|
|
@ -282,10 +282,6 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
|||
mMetrics.spaceWidth = GetCharWidth(' ', &glyphID);
|
||||
mSpaceGlyph = glyphID;
|
||||
|
||||
mMetrics.zeroOrAveCharWidth = GetCharWidth('0', &glyphID);
|
||||
if (glyphID == 0) // no zero in this font
|
||||
mMetrics.zeroOrAveCharWidth = mMetrics.aveCharWidth;
|
||||
|
||||
SanitizeMetrics(&mMetrics, mFontEntry->FamilyEntry()->IsBadUnderlineFontFamily());
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -155,16 +155,6 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
|||
mMetrics->aveCharWidth = mMetrics->emHeight * 0.5;
|
||||
}
|
||||
|
||||
// properties of '0', for 'ch' units
|
||||
gid = FT_Get_Char_Index(face, '0');
|
||||
if (gid) {
|
||||
FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE);
|
||||
mMetrics->zeroOrAveCharWidth = face->glyph->metrics.width * xScale;
|
||||
} else {
|
||||
// this font doesn't have a '0'
|
||||
mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
|
||||
}
|
||||
|
||||
// compute an adjusted size if we need to
|
||||
if (mAdjustedSize == 0 && GetStyle()->sizeAdjust != 0) {
|
||||
gfxFloat aspect = mMetrics->xHeight / GetStyle()->size;
|
||||
|
|
|
@ -963,16 +963,10 @@ gfxPangoFont::GetMetrics()
|
|||
mMetrics.emDescent = mMetrics.emHeight - mMetrics.emAscent;
|
||||
|
||||
gfxSize isz, lsz;
|
||||
PRUint32 zeroGlyph;
|
||||
GetCharSize(' ', isz, lsz, &mSpaceGlyph);
|
||||
mMetrics.spaceWidth = lsz.width;
|
||||
GetCharSize('x', isz, lsz);
|
||||
mMetrics.xHeight = isz.height;
|
||||
GetCharSize('0', isz, lsz, &zeroGlyph);
|
||||
if (zeroGlyph)
|
||||
mMetrics.zeroOrAveCharWidth = lsz.width;
|
||||
else
|
||||
mMetrics.zeroOrAveCharWidth = mMetrics.aveCharWidth;
|
||||
|
||||
FT_Face face = NULL;
|
||||
if (pfm && PANGO_IS_FC_FONT(font))
|
||||
|
|
|
@ -631,15 +631,6 @@ gfxWindowsFont::ComputeMetrics()
|
|||
GetTextExtentPoint32(dc, " ", 1, &size);
|
||||
mMetrics->spaceWidth = ROUND(size.cx);
|
||||
|
||||
// Cache the width of digit zero.
|
||||
// XXX MSDN (http://msdn.microsoft.com/en-us/library/ms534223.aspx)
|
||||
// does not say what the failure modes for GetTextExtentPoint32 are -
|
||||
// is it safe to assume it will fail iff the font has no '0'?
|
||||
if (GetTextExtentPoint32(dc, "0", 1, &size))
|
||||
mMetrics->zeroOrAveCharWidth = ROUND(size.cx);
|
||||
else
|
||||
mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
|
||||
|
||||
mSpaceGlyph = 0;
|
||||
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
|
||||
WORD glyph;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div id="source" style="font-size: 10px; -moz-column-gap: 2ch">
|
||||
<span id="test"
|
||||
style="background: green; color: green; display: inline-block;
|
||||
height: 30px; padding: 0 2px">00
|
||||
height: 30px; padding: 0 2px">MM
|
||||
</span>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -393,7 +393,7 @@ skip-if(MOZ_WIDGET_TOOLKIT=="windows") == 347496-1.xhtml 347496-1-ref.xhtml # Bu
|
|||
== 363370-1.html 363370-1-ref.html
|
||||
== 363402-1.html 363402-1-ref.html
|
||||
== 363637-1.html 363637-1-ref.html
|
||||
== 363706-1.html 363706-1-ref.html
|
||||
fails == 363706-1.html 363706-1-ref.html
|
||||
!= 363706-1.html about:blank
|
||||
== 363858-1.html 363858-1-ref.html
|
||||
== 363858-2.html 363858-2-ref.html
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
#include "nsIDeviceContext.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIThebesFontMetrics.h"
|
||||
#include "gfxFont.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsThemeConstants.h"
|
||||
|
@ -232,7 +231,8 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
|||
aFontSize = aStyleFont->mFont.size;
|
||||
}
|
||||
switch (unit) {
|
||||
case eCSSUnit_EM: {
|
||||
case eCSSUnit_EM:
|
||||
case eCSSUnit_Char: {
|
||||
return NSToCoordRound(aValue.GetFloatValue() * float(aFontSize));
|
||||
// XXX scale against font metrics height instead?
|
||||
}
|
||||
|
@ -252,18 +252,6 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
|||
nscoord capHeight = ((aFontSize / 3) * 2); // XXX HACK!
|
||||
return NSToCoordRound(aValue.GetFloatValue() * float(capHeight));
|
||||
}
|
||||
case eCSSUnit_Char: {
|
||||
nsFont font = aStyleFont->mFont;
|
||||
font.size = aFontSize;
|
||||
nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font);
|
||||
nsCOMPtr<nsIThebesFontMetrics> tfm(do_QueryInterface(fm));
|
||||
gfxFloat zeroWidth = (tfm->GetThebesFontGroup()->GetFontAt(0)
|
||||
->GetMetrics().zeroOrAveCharWidth);
|
||||
|
||||
return NSToCoordRound(aValue.GetFloatValue() *
|
||||
NS_ceil(aPresContext->AppUnitsPerDevPixel() *
|
||||
zeroWidth));
|
||||
}
|
||||
default:
|
||||
NS_NOTREACHED("unexpected unit");
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче