diff --git a/test/text-antialias-subpixel-ref.png b/test/text-antialias-subpixel-ref.png index 88c6e062b..68986ae24 100644 Binary files a/test/text-antialias-subpixel-ref.png and b/test/text-antialias-subpixel-ref.png differ diff --git a/test/text-antialias-subpixel.c b/test/text-antialias-subpixel.c index ead958d11..924065794 100644 --- a/test/text-antialias-subpixel.c +++ b/test/text-antialias-subpixel.c @@ -26,7 +26,7 @@ #include "cairo-test.h" #define WIDTH 31 -#define HEIGHT 20 +#define HEIGHT 90 #define TEXT_SIZE 12 cairo_test_t test = { @@ -41,6 +41,7 @@ draw (cairo_t *cr, int width, int height) cairo_text_extents_t extents; cairo_font_options_t *font_options; static char black[] = "black", blue[] = "blue"; + cairo_subpixel_order_t order; cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_paint (cr); @@ -54,24 +55,29 @@ draw (cairo_t *cr, int width, int height) * (bad color fringing). The reason we turn off hints here is to * try to get repeatable glyph shapes on multiple systems, not for * any aesthetic reason. */ - font_options = cairo_font_options_create (); - cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); - cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL); - cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_RGB); - cairo_set_font_options (cr, font_options); - cairo_font_options_destroy (font_options); + for (order = CAIRO_SUBPIXEL_ORDER_RGB ; order < CAIRO_SUBPIXEL_ORDER_VBGR+1 ; order++) { - cairo_set_source_rgb (cr, 0, 0, 0); /* black */ - cairo_text_extents (cr, black, &extents); - cairo_move_to (cr, -extents.x_bearing, -extents.y_bearing); - cairo_show_text (cr, black); - cairo_translate (cr, 0, -extents.y_bearing + 1); + font_options = cairo_font_options_create (); - cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ - cairo_text_extents (cr, blue, &extents); - cairo_move_to (cr, -extents.x_bearing, -extents.y_bearing); - cairo_show_text (cr, blue); + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL); + cairo_font_options_set_subpixel_order (font_options, order); + cairo_set_font_options (cr, font_options); + cairo_font_options_destroy (font_options); + + cairo_set_source_rgb (cr, 0, 0, 0); /* black */ + cairo_text_extents (cr, black, &extents); + cairo_move_to (cr, -extents.x_bearing, -extents.y_bearing); + cairo_show_text (cr, black); + cairo_translate (cr, 0, -extents.y_bearing + 2); + + cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ + cairo_text_extents (cr, blue, &extents); + cairo_move_to (cr, -extents.x_bearing, -extents.y_bearing); + cairo_show_text (cr, blue); + cairo_translate (cr, 0, -extents.y_bearing + 2); + } return CAIRO_TEST_SUCCESS; }