зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1452466 - Get rid of gfxFontStyle::ComputeWeight. r=jfkthame
This commit is contained in:
Родитель
ef1290712d
Коммит
52623f7cef
|
@ -4166,19 +4166,6 @@ gfxFontStyle::gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
|
|||
}
|
||||
}
|
||||
|
||||
int8_t
|
||||
gfxFontStyle::ComputeWeight() const
|
||||
{
|
||||
int8_t baseWeight = (weight + 50) / 100;
|
||||
|
||||
if (baseWeight < 0)
|
||||
baseWeight = 0;
|
||||
if (baseWeight > 9)
|
||||
baseWeight = 9;
|
||||
|
||||
return baseWeight;
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontStyle::AdjustForSubSuperscript(int32_t aAppUnitsPerDevPixel)
|
||||
{
|
||||
|
|
|
@ -189,8 +189,6 @@ struct gfxFontStyle {
|
|||
nsRefPtrHashKey<nsAtom>::HashKey(language);
|
||||
}
|
||||
|
||||
int8_t ComputeWeight() const;
|
||||
|
||||
// Adjust this style to simulate sub/superscript (as requested in the
|
||||
// variantSubSuper field) using size and baselineOffset instead.
|
||||
void AdjustForSubSuperscript(int32_t aAppUnitsPerDevPixel);
|
||||
|
|
|
@ -1307,8 +1307,7 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
|
|||
|
||||
aNeedsSyntheticBold = false;
|
||||
|
||||
int8_t baseWeight = aFontStyle.ComputeWeight();
|
||||
bool wantBold = baseWeight >= 6;
|
||||
bool wantBold = aFontStyle.weight >= 600;
|
||||
gfxFontEntry *fe = nullptr;
|
||||
|
||||
// If the family has only one face, we simply return it; no further
|
||||
|
@ -1502,7 +1501,7 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
|
|||
}
|
||||
|
||||
// measure of closeness of weight to the desired value
|
||||
rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight());
|
||||
rank += 9 - Abs((aFontEntry->Weight() - aStyle->weight) / 100);
|
||||
} else {
|
||||
// if no font to match, prefer non-bold, non-italic fonts
|
||||
if (aFontEntry->IsUpright()) {
|
||||
|
|
|
@ -3444,7 +3444,7 @@ gfxFontGroup::WhichSystemFontSupportsChar(uint32_t aCh, uint32_t aNextCh,
|
|||
gfxPlatformFontList::PlatformFontList()->
|
||||
SystemFindFontForChar(aCh, aNextCh, aRunScript, &mStyle);
|
||||
if (fe) {
|
||||
bool wantBold = mStyle.ComputeWeight() >= 6;
|
||||
bool wantBold = mStyle.weight >= 600;
|
||||
return fe->FindOrMakeFont(&mStyle, wantBold && !fe->IsBold());
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче