зеркало из https://github.com/mozilla/gecko-dev.git
Bug 504698. Force Cleartype rendering of content on XP based on pref (follow-on). r=jkew
This commit is contained in:
Родитель
8adc0c8eec
Коммит
a771fdd41d
|
@ -168,7 +168,7 @@ public:
|
|||
mName(aName), mItalic(PR_FALSE), mFixedPitch(PR_FALSE),
|
||||
mIsProxy(PR_FALSE), mIsValid(PR_TRUE),
|
||||
mIsBadUnderlineFont(PR_FALSE), mIsUserFont(PR_FALSE),
|
||||
mStandardFace(aIsStandardFace),
|
||||
mIsLocalUserFont(PR_FALSE), mStandardFace(aIsStandardFace),
|
||||
mSymbolFont(PR_FALSE),
|
||||
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
|
||||
mCmapInitialized(PR_FALSE),
|
||||
|
@ -186,6 +186,7 @@ public:
|
|||
PRInt16 Stretch() const { return mStretch; }
|
||||
|
||||
PRBool IsUserFont() const { return mIsUserFont; }
|
||||
PRBool IsLocalUserFont() const { return mIsLocalUserFont; }
|
||||
PRBool IsFixedPitch() const { return mFixedPitch; }
|
||||
PRBool IsItalic() const { return mItalic; }
|
||||
PRBool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
|
||||
|
@ -226,6 +227,7 @@ public:
|
|||
PRPackedBool mIsValid : 1;
|
||||
PRPackedBool mIsBadUnderlineFont : 1;
|
||||
PRPackedBool mIsUserFont : 1;
|
||||
PRPackedBool mIsLocalUserFont : 1;
|
||||
PRPackedBool mStandardFace : 1;
|
||||
PRPackedBool mSymbolFont : 1;
|
||||
|
||||
|
@ -250,6 +252,7 @@ protected:
|
|||
mIsProxy(PR_FALSE), mIsValid(PR_TRUE),
|
||||
mIsBadUnderlineFont(PR_FALSE),
|
||||
mIsUserFont(PR_FALSE),
|
||||
mIsLocalUserFont(PR_FALSE),
|
||||
mStandardFace(PR_FALSE),
|
||||
mSymbolFont(PR_FALSE),
|
||||
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
|
||||
|
@ -482,6 +485,14 @@ public:
|
|||
// font; we just delete it.
|
||||
virtual void NotifyExpired(gfxFont *aFont);
|
||||
|
||||
// Cleans out the hashtable and removes expired fonts waiting for cleanup.
|
||||
// Other gfxFont objects may be still in use but they will be pushed
|
||||
// into the expiration queues and removed.
|
||||
void Flush() {
|
||||
mFonts.Clear();
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
||||
protected:
|
||||
void DestroyFont(gfxFont *aFont);
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ public:
|
|||
*/
|
||||
static void RemoveTextRun(gfxTextRun *aTextRun);
|
||||
|
||||
static void Flush();
|
||||
|
||||
protected:
|
||||
friend class gfxPlatform;
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
mStretch = aStretch;
|
||||
mItalic = aItalic;
|
||||
mIsUserFont = PR_TRUE;
|
||||
mIsLocalUserFont = PR_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -167,6 +167,7 @@ gfxFontEntry::FindOrMakeFont(const gfxFontStyle *aStyle, PRBool aNeedsBold)
|
|||
{
|
||||
// the font entry name is the psname, not the family name
|
||||
nsRefPtr<gfxFont> font = gfxFontCache::GetCache()->Lookup(Name(), aStyle);
|
||||
|
||||
if (!font) {
|
||||
gfxFont *newFont = CreateFontInstance(aStyle, aNeedsBold);
|
||||
if (!newFont)
|
||||
|
|
|
@ -199,15 +199,7 @@ GDIFontEntry::GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontT
|
|||
mForceGDI = PR_TRUE;
|
||||
mIsUserFont = aUserFontData != nsnull;
|
||||
|
||||
PRBool isXP = (gfxWindowsPlatform::WindowsOSVersion()
|
||||
< gfxWindowsPlatform::kWindowsVista);
|
||||
|
||||
PRBool useClearType = isXP &&
|
||||
(gfxWindowsPlatform::GetPlatform()->UseClearTypeAlways() ||
|
||||
(mIsUserFont &&
|
||||
gfxWindowsPlatform::GetPlatform()->UseClearTypeForDownloadableFonts()));
|
||||
|
||||
InitLogFont(aFaceName, aFontType, useClearType);
|
||||
InitLogFont(aFaceName, aFontType);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -241,9 +233,9 @@ GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, PRBool aNeedsBo
|
|||
PRBool isXP = (gfxWindowsPlatform::WindowsOSVersion()
|
||||
< gfxWindowsPlatform::kWindowsVista);
|
||||
|
||||
PRBool useClearType = isXP &&
|
||||
PRBool useClearType = isXP && !aFontStyle->systemFont &&
|
||||
(gfxWindowsPlatform::GetPlatform()->UseClearTypeAlways() ||
|
||||
(mIsUserFont &&
|
||||
(mIsUserFont && !mIsLocalUserFont &&
|
||||
gfxWindowsPlatform::GetPlatform()->UseClearTypeForDownloadableFonts()));
|
||||
|
||||
return new gfxGDIFont(this, aFontStyle, aNeedsBold,
|
||||
|
@ -287,6 +279,7 @@ GDIFontEntry::FillLogFont(LOGFONTW *aLogFont, PRBool aItalic,
|
|||
// do fake italic for us in that case.
|
||||
aLogFont->lfItalic = aItalic;
|
||||
aLogFont->lfWeight = aWeight;
|
||||
aLogFont->lfQuality = (aUseCleartype ? CLEARTYPE_QUALITY : DEFAULT_QUALITY);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -356,8 +349,7 @@ GDIFontEntry::TestCharacterMap(PRUint32 aCh)
|
|||
|
||||
void
|
||||
GDIFontEntry::InitLogFont(const nsAString& aName,
|
||||
gfxWindowsFontType aFontType,
|
||||
PRBool aUseCleartype)
|
||||
gfxWindowsFontType aFontType)
|
||||
{
|
||||
#define CLIP_TURNOFF_FONTASSOCIATION 0x40
|
||||
|
||||
|
@ -372,7 +364,7 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
|
|||
mLogFont.lfCharSet = DEFAULT_CHARSET;
|
||||
mLogFont.lfOutPrecision = FontTypeToOutPrecision(aFontType);
|
||||
mLogFont.lfClipPrecision = CLIP_TURNOFF_FONTASSOCIATION;
|
||||
mLogFont.lfQuality = (aUseCleartype ? CLEARTYPE_QUALITY : DEFAULT_QUALITY);
|
||||
mLogFont.lfQuality = DEFAULT_QUALITY;
|
||||
mLogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
|
||||
// always force lfItalic if we want it. Font selection code will
|
||||
// do its best to give us an italic font entry, but if no face exists
|
||||
|
@ -693,6 +685,7 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
|||
return nsnull;
|
||||
|
||||
fe->mIsUserFont = PR_TRUE;
|
||||
fe->mIsLocalUserFont = PR_TRUE;
|
||||
return fe;
|
||||
}
|
||||
|
||||
|
|
|
@ -300,8 +300,7 @@ protected:
|
|||
GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontType,
|
||||
PRBool aItalic, PRUint16 aWeight, gfxUserFontData *aUserFontData);
|
||||
|
||||
void InitLogFont(const nsAString& aName, gfxWindowsFontType aFontType,
|
||||
PRBool aUseCleartype);
|
||||
void InitLogFont(const nsAString& aName, gfxWindowsFontType aFontType);
|
||||
|
||||
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, PRBool aNeedsBold);
|
||||
|
||||
|
|
|
@ -289,6 +289,7 @@ public:
|
|||
mPatterns.AppendElement();
|
||||
mPatterns[i].own(pattern);
|
||||
}
|
||||
mIsLocalUserFont = PR_TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -138,3 +138,4 @@ gfxTextRunCache::Shutdown()
|
|||
delete gTextRunCache;
|
||||
gTextRunCache = nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,13 @@ public:
|
|||
*/
|
||||
void RemoveTextRun(gfxTextRun *aTextRun);
|
||||
|
||||
void Flush() {
|
||||
mCache.Clear();
|
||||
#ifdef DEBUG
|
||||
mGeneration++;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PRUint32 mGeneration;
|
||||
void Dump();
|
||||
|
@ -1010,3 +1017,11 @@ gfxTextRunWordCache::RemoveTextRun(gfxTextRun *aTextRun)
|
|||
return;
|
||||
gTextRunWordCache->RemoveTextRun(aTextRun);
|
||||
}
|
||||
|
||||
void
|
||||
gfxTextRunWordCache::Flush()
|
||||
{
|
||||
if (!gTextRunWordCache)
|
||||
return;
|
||||
gTextRunWordCache->Flush();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxWindowsSurface.h"
|
||||
#include "gfxTextRunWordCache.h"
|
||||
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
|
@ -492,7 +493,7 @@ gfxWindowsPlatform::InitDisplayCaps()
|
|||
void
|
||||
gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
|
||||
{
|
||||
PRBool clearFontCache = PR_TRUE;
|
||||
PRBool clearTextFontCaches = PR_TRUE;
|
||||
|
||||
gfxPlatform::FontsPrefsChanged(aPrefBranch, aPref);
|
||||
|
||||
|
@ -504,12 +505,14 @@ gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aP
|
|||
} else if (!strcmp(GFX_USE_CLEARTYPE_ALWAYS, aPref)) {
|
||||
mUseClearTypeAlways = UNINITIALIZED_VALUE;
|
||||
} else {
|
||||
clearFontCache = PR_FALSE;
|
||||
clearTextFontCaches = PR_FALSE;
|
||||
}
|
||||
|
||||
if (clearFontCache) {
|
||||
if (clearTextFontCaches) {
|
||||
gfxFontCache *fc = gfxFontCache::GetCache();
|
||||
if (fc)
|
||||
fc->AgeAllGenerations();
|
||||
if (fc) {
|
||||
fc->Flush();
|
||||
}
|
||||
gfxTextRunWordCache::Flush();
|
||||
}
|
||||
}
|
|
@ -308,6 +308,9 @@ nsPresContext::~nsPresContext()
|
|||
|
||||
delete mBidiUtils;
|
||||
#endif // IBMBIDI
|
||||
nsContentUtils::UnregisterPrefCallback("gfx.font_rendering.",
|
||||
nsPresContext::PrefChangedCallback,
|
||||
this);
|
||||
nsContentUtils::UnregisterPrefCallback("layout.css.dpi",
|
||||
nsPresContext::PrefChangedCallback,
|
||||
this);
|
||||
|
@ -806,6 +809,10 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
|||
// Changes to bidi.numeral also needs to empty the text run cache.
|
||||
// This is handled in gfxTextRunWordCache.cpp.
|
||||
}
|
||||
if (StringBeginsWith(prefName, NS_LITERAL_CSTRING("gfx.font_rendering."))) {
|
||||
// Changes to font_rendering prefs need to trigger a reflow
|
||||
mPrefChangePendingNeedsReflow = PR_TRUE;
|
||||
}
|
||||
// we use a zero-delay timer to coalesce multiple pref updates
|
||||
if (!mPrefChangedTimer)
|
||||
{
|
||||
|
@ -915,6 +922,8 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
|
|||
nsContentUtils::RegisterPrefCallback("bidi.", PrefChangedCallback,
|
||||
this);
|
||||
#endif
|
||||
nsContentUtils::RegisterPrefCallback("gfx.font_rendering.", PrefChangedCallback,
|
||||
this);
|
||||
nsContentUtils::RegisterPrefCallback("layout.css.dpi",
|
||||
nsPresContext::PrefChangedCallback,
|
||||
this);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Bug 533251 crashtest</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
|
|
@ -27,15 +27,15 @@ HTTP(..) == src-list-format-6.html src-list-format-3-ref.html
|
|||
# assumes AAT fonts are only supported on MacOS
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == src-list-format-7.html src-list-format-2-ref.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT!="cocoa") HTTP(..) == src-list-format-7.html src-list-format-3-ref.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") == src-list-local-full.html src-list-local-full-ref.html # bug 504698
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") == src-list-local-full-quotes.html src-list-local-full-ref.html # bug 504698
|
||||
== src-list-local-full.html src-list-local-full-ref.html
|
||||
== src-list-local-full-quotes.html src-list-local-full-ref.html
|
||||
HTTP(..) == src-list-local-fallback.html src-list-local-fallback-ref.html
|
||||
|
||||
# localized full fontnames should *not* match, only English ones (need locale-invariant key)
|
||||
skip HTTP(..) == src-list-local-localized.html src-list-local-localized-ref.html # 486787, 486497
|
||||
|
||||
# Postscript name lookup only supported on MacOS/Windows currently
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == src-list-local-ps.html src-list-local-full-ref.html # bug 504698
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == src-list-local-ps.html src-list-local-full-ref.html
|
||||
# Mac-specific test of 100 weight faces
|
||||
random-if(MOZ_WIDGET_TOOLKIT!="cocoa") == helveticaneue-ultra.html helveticaneue-ultra-ref.html
|
||||
|
||||
|
@ -85,7 +85,7 @@ HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html
|
|||
# random-if(MOZ_WIDGET_TOOLKIT!="cocoa") HTTP(..) == src-format-arabic.html src-format-arabic-aat-ref.html
|
||||
# random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == src-format-arabic.html src-format-arabic-ot-ref.html
|
||||
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="windows") == local-1.html local-1-ref.html # bug 504698
|
||||
== local-1.html local-1-ref.html
|
||||
HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html
|
||||
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == synthetic-variations.html synthetic-variations-ref.html # bug 419962
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче