Bug 661471. Part 7: Only force GDI_CLASSIC rendering for specified fonts if a rendering mode has not been explicitly chosen in prefs. r=roc

This commit is contained in:
Jonathan Kew 2011-06-09 08:17:20 +01:00
parent 37cc5bd232
commit 4ce8038dca
5 changed files with 26 additions and 6 deletions

View File

@ -1107,6 +1107,12 @@ cairo_dwrite_set_cleartype_params(FLOAT gamma, FLOAT contrast, FLOAT level,
DWriteFactory::SetRenderingParams(gamma, contrast, level, geometry, mode);
}
int
cairo_dwrite_get_cleartype_rendering_mode()
{
return DWriteFactory::GetClearTypeRenderingMode();
}
cairo_int_status_t
_dwrite_draw_glyphs_to_gdi_surface_gdi(cairo_win32_surface_t *surface,
DWRITE_MATRIX *transform,

View File

@ -110,9 +110,14 @@ public:
{
CreateRenderingParams();
}
IDWriteRenderingParams *params =
mode == cairo_d2d_surface_t::TEXT_RENDERING_NORMAL ? mCustomClearTypeRenderingParams :
(mode == cairo_d2d_surface_t::TEXT_RENDERING_GDI_CLASSIC ? mForceGDIClassicRenderingParams : mDefaultRenderingParams);
IDWriteRenderingParams *params;
if (mode == cairo_d2d_surface_t::TEXT_RENDERING_NO_CLEARTYPE) {
params = mDefaultRenderingParams;
} else if (mode == cairo_d2d_surface_t::TEXT_RENDERING_GDI_CLASSIC && mRenderingMode < 0) {
params = mForceGDIClassicRenderingParams;
} else {
params = mCustomClearTypeRenderingParams;
}
if (params) {
params->AddRef();
}
@ -145,6 +150,10 @@ public:
}
}
static int GetClearTypeRenderingMode() {
return mRenderingMode;
}
private:
static void CreateRenderingParams();

View File

@ -137,6 +137,9 @@ cairo_dwrite_scaled_font_get_force_GDI_classic(cairo_scaled_font_t *dwrite_scale
void
cairo_dwrite_set_cleartype_params(FLOAT gamma, FLOAT contrast, FLOAT level, int geometry, int mode);
int
cairo_dwrite_get_cleartype_rendering_mode();
#endif /* CAIRO_HAS_DWRITE_FONT */
#if CAIRO_HAS_D2D_SURFACE

View File

@ -694,7 +694,8 @@ bool
gfxDWriteFont::GetForceGDIClassic()
{
return static_cast<gfxDWriteFontEntry*>(mFontEntry.get())->GetForceGDIClassic() &&
GetAdjustedSize() <=
cairo_dwrite_get_cleartype_rendering_mode() < 0 &&
GetAdjustedSize() <=
gfxDWriteFontList::PlatformFontList()->GetForceGDIClassicMaxFontSize();
}

View File

@ -1808,8 +1808,9 @@ pref("gfx.font_rendering.cleartype_params.pixel_structure", -1);
pref("gfx.font_rendering.cleartype_params.rendering_mode", -1);
// A comma-separated list of font family names. Fonts in these families will
// be forced to use "GDI Classic" ClearType mode, ignoring the value
// of gfx.font_rendering.cleartype_params.rendering_mode.
// be forced to use "GDI Classic" ClearType mode, provided the value
// of gfx.font_rendering.cleartype_params.rendering_mode is -1
// (i.e. a specific rendering_mode has not been explicitly set).
// Currently we apply this setting to the sans-serif Microsoft "core Web fonts".
pref("gfx.font_rendering.cleartype_params.force_gdi_classic_for_families",
"Arial,Courier New,Segoe UI,Tahoma,Trebuchet MS,Verdana");