Changeset 69786 in webkit


Ignore:
Timestamp:
Oct 14, 2010 11:52:52 AM (13 years ago)
Author:
Martin Robinson
Message:

2010-10-01 Martin Robinson <mrobinson@igalia.com>

Reviewed by Holger Freyther.

[GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
https://bugs.webkit.org/show_bug.cgi?id=47033

Added a platform-specific test which verifies that if XSettings
specifies subpixel aliasing, it is the default rendering style.

  • platform/gtk/fonts/xsettings_antialias_settings-expected.checksum: Added.
  • platform/gtk/fonts/xsettings_antialias_settings-expected.png: Added.
  • platform/gtk/fonts/xsettings_antialias_settings-expected.txt: Added.
  • platform/gtk/fonts/xsettings_antialias_settings.html: Added.

2010-10-01 Martin Robinson <mrobinson@igalia.com>

Reviewed by Holger Freyther.

[GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
https://bugs.webkit.org/show_bug.cgi?id=47033

Fix logic that merges XSettings defaults and FontConfig settings. If
FontConfig or XSettings specifies a subpixel order, we force subpixel
anti-aliasing on. If anti-aliasing is turned on explicitly, only
override the setting if it was previously off, otherwise we ignore
the user's preference for subpixel or gray antialiasing.

Test: platform/gtk/fonts/xsettings_antialias_settings.html

  • platform/graphics/cairo/FontPlatformDataFreeType.cpp: (WebCore::setCairoFontOptionsFromFontConfigPattern): Fix merging of XSettings and FontConfig anti-aliasing settings. (WebCore::getDefaultFontOptions): Added this helper. (WebCore::FontPlatformData::FontPlatformData): Use the getDefaultFontOptions helper.

2010-10-01 Martin Robinson <mrobinson@igalia.com>

Reviewed by Holger Freyther.

[GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
https://bugs.webkit.org/show_bug.cgi?id=47033

  • DumpRenderTree/gtk/DumpRenderTree.cpp: (initializeGtkFontSettings): Added this method which initializes XSettings font settings to consistent values before running a test. For the one test in which we need subpixel aliasing turned on, do that. (initializeFonts): Accepts a testURL parameter now and delegates to initializeGtkFontSettings. (runTest): Pass the testURL to initializeFonts.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69785 r69786  
     12010-10-01  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
     6        https://bugs.webkit.org/show_bug.cgi?id=47033
     7
     8        Added a platform-specific test which verifies that if XSettings
     9        specifies subpixel aliasing, it is the default rendering style.
     10
     11        * platform/gtk/fonts/xsettings_antialias_settings-expected.checksum: Added.
     12        * platform/gtk/fonts/xsettings_antialias_settings-expected.png: Added.
     13        * platform/gtk/fonts/xsettings_antialias_settings-expected.txt: Added.
     14        * platform/gtk/fonts/xsettings_antialias_settings.html: Added.
     15
    1162010-10-14  Nate Chapin  <japhet@chromium.org>
    217
  • trunk/WebCore/ChangeLog

    r69782 r69786  
     12010-10-01  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
     6        https://bugs.webkit.org/show_bug.cgi?id=47033
     7
     8        Fix logic that merges XSettings defaults and FontConfig settings. If
     9        FontConfig or XSettings specifies a subpixel order, we force subpixel
     10        anti-aliasing on. If anti-aliasing is turned on explicitly, only
     11        override the setting if it was previously off, otherwise we ignore
     12        the user's preference for subpixel or gray antialiasing.
     13
     14        Test: platform/gtk/fonts/xsettings_antialias_settings.html
     15
     16        * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
     17        (WebCore::setCairoFontOptionsFromFontConfigPattern): Fix merging of XSettings
     18        and FontConfig anti-aliasing settings.
     19        (WebCore::getDefaultFontOptions): Added this helper.
     20        (WebCore::FontPlatformData::FontPlatformData): Use the getDefaultFontOptions helper.
     21
    1222010-10-14  Jian Li  <jianli@chromium.org>
    223
  • trunk/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp

    r69776 r69786  
    7676    int integerResult;
    7777
    78     // We will determine if subpixel anti-aliasing is enabled via the FC_RGBA setting.
    79     if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &booleanResult) == FcResultMatch && booleanResult)
    80         cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
    81 
    8278    if (FcPatternGetInteger(pattern, FC_RGBA, 0, &integerResult) == FcResultMatch) {
     79        cairo_font_options_set_subpixel_order(options, convertFontConfigSubpixelOrder(integerResult));
     80
     81        // Based on the logic in cairo-ft-font.c in the cairo source, a font with
     82        // a subpixel order implies that is uses subpixel antialiasing.
    8383        if (integerResult != FC_RGBA_NONE)
    8484            cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_SUBPIXEL);
    85         cairo_font_options_set_subpixel_order(options, convertFontConfigSubpixelOrder(integerResult));
     85    }
     86
     87    if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &booleanResult) == FcResultMatch) {
     88        // Only override the anti-aliasing setting if was previously turned off. Otherwise
     89        // we'll override the preference which decides between gray anti-aliasing and
     90        // subpixel anti-aliasing.
     91        if (!booleanResult)
     92            cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_NONE);
     93        else if (cairo_font_options_get_antialias(options) == CAIRO_ANTIALIAS_NONE)
     94            cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
    8695    }
    8796
    8897    if (FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &integerResult) == FcResultMatch)
    8998        cairo_font_options_set_hint_style(options, convertFontConfigHintStyle(integerResult));
    90 
    9199    if (FcPatternGetBool(pattern, FC_HINTING, 0, &booleanResult) == FcResultMatch && !booleanResult)
    92100        cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
     101}
     102
     103static const cairo_font_options_t* getDefaultFontOptions()
     104{
     105    static const cairo_font_options_t* options = cairo_font_options_create();
     106#if PLATFORM(GTK) || ENABLE(GLIB_SUPPORT)
     107    if (GdkScreen* screen = gdk_screen_get_default()) {
     108        const cairo_font_options_t* screenOptions = gdk_screen_get_font_options(screen);
     109        if (screenOptions)
     110            options = screenOptions;
     111    }
     112#endif
     113    return options;
    93114}
    94115
     
    210231void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
    211232{
    212     cairo_font_options_t* options = 0;
    213 #if !PLATFORM(EFL) || ENABLE(GLIB_SUPPORT)
    214     if (GdkScreen* screen = gdk_screen_get_default())
    215         options = cairo_font_options_copy(gdk_screen_get_font_options(screen));
    216 #endif
    217     // gdk_screen_get_font_options() returns null if no default
    218     // options are set, so we always have to check.
    219     if (!options)
    220         options = cairo_font_options_create();
     233    cairo_font_options_t* options = cairo_font_options_copy(getDefaultFontOptions());
    221234
    222235    cairo_matrix_t ctm;
  • trunk/WebKitTools/ChangeLog

    r69770 r69786  
     12010-10-01  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [GTK] REGRESSION: FreeType backend does not respect XSettings font settings after r68558
     6        https://bugs.webkit.org/show_bug.cgi?id=47033
     7
     8        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     9        (initializeGtkFontSettings): Added this method which initializes XSettings
     10        font settings to consistent values before running a test. For the one test
     11        in which we need subpixel aliasing turned on, do that.
     12        (initializeFonts): Accepts a testURL parameter now and delegates to initializeGtkFontSettings.
     13        (runTest): Pass the testURL to initializeFonts.
     14
    1152010-10-14  Adam Barth  <abarth@webkit.org>
    216
  • trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r69528 r69786  
    132132}
    133133
    134 static void initializeFonts()
     134static void initializeGtkFontSettings(const char* testURL)
     135{
     136    GtkSettings* settings = gtk_settings_get_default();
     137    if (!settings)
     138        return;
     139    g_object_set(settings, "gtk-xft-antialias", 1, NULL);
     140    g_object_set(settings, "gtk-xft-hinting", 1, NULL);
     141    g_object_set(settings, "gtk-xft-hintstyle", "hintfull", NULL);
     142
     143    // One test needs subpixel anti-aliasing turned on, but generally we
     144    // want all text in other tests to use to grayscale anti-aliasing.
     145    if (testURL && strstr(testURL, "xsettings_antialias_settings.html"))
     146        g_object_set(settings, "gtk-xft-rgba", "rgb", NULL);
     147    else
     148        g_object_set(settings, "gtk-xft-rgba", "none", NULL);
     149}
     150
     151static void initializeFonts(const char* testURL = 0)
    135152{
    136153#if PLATFORM(X11)
     154    initializeGtkFontSettings(testURL);
     155
    137156    FcInit();
    138157
     
    615634        g_object_ref(prevTestBFItem);
    616635
    617     initializeFonts();
     636    initializeFonts(testURL.c_str());
    618637
    619638    // Focus the web view before loading the test to avoid focusing problems
Note: See TracChangeset for help on using the changeset viewer.