b=480098 correct weight units in gfxFcFontEntry::AdjustPatternToCSS r=roc

--HG--
extra : rebase_source : 79604f227fc80720e4df479f1d8929f5c21623f2
This commit is contained in:
Karl Tomlinson 2009-03-11 15:00:43 +13:00
parent b124621b45
commit b16ecea3e6
4 changed files with 7 additions and 3 deletions

View File

@ -149,6 +149,9 @@ gfxFontconfigUtils::GetThebesWeight(FcPattern *aPattern)
/* static */ int
gfxFontconfigUtils::FcWeightForBaseWeight(PRInt8 aBaseWeight)
{
NS_PRECONDITION(aBaseWeight >= 0 && aBaseWeight <= 10,
"base weight out of range");
switch (aBaseWeight) {
case 2:
return FC_WEIGHT_EXTRALIGHT;

View File

@ -150,7 +150,8 @@ public:
static PRUint16 GetThebesWeight(FcPattern *aPattern);
static int GetFcSlant(const gfxFontStyle& aFontStyle);
// Returns a precise FC_WEIGHT from CSS weight |aBaseWeight|.
// Returns a precise FC_WEIGHT from |aBaseWeight|,
// which is a CSS absolute weight / 100.
static int FcWeightForBaseWeight(PRInt8 aBaseWeight);
static PRBool GetFullnameFromFamilyAndStyle(FcPattern *aFont,

View File

@ -209,7 +209,7 @@ gfxFcFontEntry::AdjustPatternToCSS(FcPattern *aPattern)
{
int fontWeight = -1;
FcPatternGetInteger(aPattern, FC_WEIGHT, 0, &fontWeight);
int cssWeight = gfxFontconfigUtils::FcWeightForBaseWeight(mWeight);
int cssWeight = gfxFontconfigUtils::FcWeightForBaseWeight(mWeight / 100);
if (cssWeight != fontWeight) {
FcPatternDel(aPattern, FC_WEIGHT);
FcPatternAddInteger(aPattern, FC_WEIGHT, cssWeight);

View File

@ -77,4 +77,4 @@ HTTP(..) == ex-unit-1.html ex-unit-1-ref.html
HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html
fails-if(MOZ_WIDGET_TOOLKIT=="windows") == local-1.html local-1-ref.html # bug 468387
fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html # bug 468387, 480098
fails-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html # bug 468387