mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 418479. Allow antialiased text rendering to be disabled for small text sizes via a pref. r+sr=vlad, a=damons
This commit is contained in:
parent
05b913ced9
commit
9a2ab9c8d7
@ -80,14 +80,21 @@ public:
|
|||||||
// Ex: Mac OS X 10.4.x ==> 0x104x
|
// Ex: Mac OS X 10.4.x ==> 0x104x
|
||||||
PRInt32 OSXVersion();
|
PRInt32 OSXVersion();
|
||||||
|
|
||||||
|
// lower threshold on font anti-aliasing
|
||||||
|
PRUint32 GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void gfxPlatformMac::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen,
|
void gfxPlatformMac::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen,
|
||||||
eFontPrefLang aCharLang, eFontPrefLang aPageLang);
|
eFontPrefLang aCharLang, eFontPrefLang aPageLang);
|
||||||
|
|
||||||
virtual cmsHPROFILE GetPlatformCMSOutputProfile();
|
virtual cmsHPROFILE GetPlatformCMSOutputProfile();
|
||||||
|
|
||||||
|
// read in the pref value for the lower threshold on font anti-aliasing
|
||||||
|
static PRUint32 ReadAntiAliasingThreshold();
|
||||||
|
|
||||||
nsTArray<PRUint32> mCJKPrefLangs;
|
nsTArray<PRUint32> mCJKPrefLangs;
|
||||||
PRInt32 mOSXVersion;
|
PRInt32 mOSXVersion;
|
||||||
|
PRUint32 mFontAntiAliasingThreshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* GFX_PLATFORM_MAC_H */
|
#endif /* GFX_PLATFORM_MAC_H */
|
||||||
|
@ -140,6 +140,13 @@ gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||||
|
|
||||||
|
// turn off font anti-aliasing based on user pref setting
|
||||||
|
if (mAdjustedSize <= (float) gfxPlatformMac::GetPlatform()->GetAntiAliasingThreshold()) {
|
||||||
|
cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_NONE);
|
||||||
|
//printf("font: %s, size: %f, disabling anti-aliasing\n", NS_ConvertUTF16toUTF8(mName).get(), mAdjustedSize);
|
||||||
|
}
|
||||||
|
|
||||||
mScaledFont = cairo_scaled_font_create(mFontFace, &sizeMatrix, &ctm, fontOptions);
|
mScaledFont = cairo_scaled_font_create(mFontFace, &sizeMatrix, &ctm, fontOptions);
|
||||||
cairo_font_options_destroy(fontOptions);
|
cairo_font_options_destroy(fontOptions);
|
||||||
NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS,
|
NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS,
|
||||||
|
@ -65,6 +65,7 @@ gfxPlatformMac::gfxPlatformMac()
|
|||||||
glitz_agl_init();
|
glitz_agl_init();
|
||||||
#endif
|
#endif
|
||||||
mOSXVersion = 0;
|
mOSXVersion = 0;
|
||||||
|
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxASurface>
|
already_AddRefed<gfxASurface>
|
||||||
@ -336,6 +337,39 @@ gfxPlatformMac::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, e
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRUint32
|
||||||
|
gfxPlatformMac::ReadAntiAliasingThreshold()
|
||||||
|
{
|
||||||
|
PRUint32 threshold = 0; // default == no threshold
|
||||||
|
|
||||||
|
// first read prefs flag to determine whether to use the setting or not
|
||||||
|
PRBool useAntiAliasingThreshold = PR_FALSE;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
PRBool enabled;
|
||||||
|
nsresult rv =
|
||||||
|
prefs->GetBoolPref("gfx.use_text_smoothing_setting", &enabled);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
useAntiAliasingThreshold = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the pref setting is disabled, return 0 which effectively disables this feature
|
||||||
|
if (!useAntiAliasingThreshold)
|
||||||
|
return threshold;
|
||||||
|
|
||||||
|
// value set via Appearance pref panel, "Turn off text smoothing for font sizes xxx and smaller"
|
||||||
|
CFNumberRef prefValue = (CFNumberRef)CFPreferencesCopyAppValue(CFSTR("AppleAntiAliasingThreshold"), kCFPreferencesCurrentApplication);
|
||||||
|
|
||||||
|
if (prefValue) {
|
||||||
|
if (!CFNumberGetValue(prefValue, kCFNumberIntType, &threshold)) {
|
||||||
|
threshold = 0;
|
||||||
|
}
|
||||||
|
CFRelease(prefValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return threshold;
|
||||||
|
}
|
||||||
|
|
||||||
cmsHPROFILE
|
cmsHPROFILE
|
||||||
gfxPlatformMac::GetPlatformCMSOutputProfile()
|
gfxPlatformMac::GetPlatformCMSOutputProfile()
|
||||||
|
@ -172,6 +172,9 @@ pref("accessibility.typeaheadfind.soundURL", "beep");
|
|||||||
pref("accessibility.typeaheadfind.enablesound", true);
|
pref("accessibility.typeaheadfind.enablesound", true);
|
||||||
pref("accessibility.typeaheadfind.prefillwithselection", true);
|
pref("accessibility.typeaheadfind.prefillwithselection", true);
|
||||||
|
|
||||||
|
// use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default
|
||||||
|
pref("gfx.use_text_smoothing_setting", false);
|
||||||
|
|
||||||
pref("browser.history_expire_days", 9);
|
pref("browser.history_expire_days", 9);
|
||||||
|
|
||||||
// loading and rendering of framesets and iframes
|
// loading and rendering of framesets and iframes
|
||||||
|
Loading…
Reference in New Issue
Block a user