mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 635640 - force font metrics of Arial Black to match the main Arial family; r=Bas
This commit is contained in:
parent
ed99bde8e4
commit
559ac56c3a
@ -200,11 +200,35 @@ gfxDWriteFont::GetMetrics()
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
PRBool
|
||||
gfxDWriteFont::GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics)
|
||||
{
|
||||
gfxFontStyle style(mStyle);
|
||||
style.weight = 700;
|
||||
PRBool needsBold;
|
||||
gfxFontEntry *fe = mFontEntry->Family()->FindFontForStyle(style, needsBold);
|
||||
if (!fe || fe == mFontEntry) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxFont> font = fe->FindOrMakeFont(&style, needsBold);
|
||||
gfxDWriteFont *dwFont = static_cast<gfxDWriteFont*>(font.get());
|
||||
dwFont->mFontFace->GetMetrics(aFontMetrics);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gfxDWriteFont::ComputeMetrics()
|
||||
{
|
||||
DWRITE_FONT_METRICS fontMetrics;
|
||||
mFontFace->GetMetrics(&fontMetrics);
|
||||
if (!(mFontEntry->Weight() == 900 &&
|
||||
!mFontEntry->IsUserFont() &&
|
||||
mFontEntry->FamilyName().EqualsLiteral("Arial") &&
|
||||
GetFakeMetricsForArialBlack(&fontMetrics)))
|
||||
{
|
||||
mFontFace->GetMetrics(&fontMetrics);
|
||||
}
|
||||
|
||||
if (mStyle.sizeAdjust != 0.0) {
|
||||
gfxFloat aspect = (gfxFloat)fontMetrics.xHeight /
|
||||
|
@ -90,6 +90,8 @@ protected:
|
||||
|
||||
virtual void CreatePlatformShaper();
|
||||
|
||||
PRBool GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics);
|
||||
|
||||
void ComputeMetrics();
|
||||
|
||||
PRBool HasBitmapStrikeForSize(PRUint32 aSize);
|
||||
|
@ -223,6 +223,8 @@ public:
|
||||
// unique name for the face, *not* the family
|
||||
const nsString& Name() const { return mName; }
|
||||
|
||||
gfxFontFamily* Family() const { return mFamily; }
|
||||
|
||||
PRUint16 Weight() const { return mWeight; }
|
||||
PRInt16 Stretch() const { return mStretch; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user