summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@mandriva.com>2006-02-23 16:44:19 -0800
committerCarl Worth <cworth@cworth.org>2006-02-23 16:44:19 -0800
commit540c10f3fb529ad7650065a8b11735027d60b28c (patch)
tree0f21b07dd415c5e5314af8287c563367fab3ff20
parent886bc4ddb0cc9bf0c187919d03446d05e44c6714 (diff)
downloadcairo-540c10f3fb529ad7650065a8b11735027d60b28c.tar.gz
test/text-antialias-subpixel: Modify to demonstrate problem with subpixel BGR and VRGB
-rw-r--r--test/text-antialias-subpixel-ref.pngbin1081 -> 3833 bytes
-rw-r--r--test/text-antialias-subpixel.c38
2 files changed, 22 insertions, 16 deletions
diff --git a/test/text-antialias-subpixel-ref.png b/test/text-antialias-subpixel-ref.png
index 88c6e062b..68986ae24 100644
--- a/test/text-antialias-subpixel-ref.png
+++ b/test/text-antialias-subpixel-ref.png
Binary files 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;
}