summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/cairo-test.c10
-rw-r--r--test/clip-operator.c9
-rw-r--r--test/font-matrix-translation.c9
-rw-r--r--test/ft-font-create-for-ft-face.c2
-rw-r--r--test/ft-text-antialias-none.c3
-rw-r--r--test/ft-text-vertical-layout.c5
-rw-r--r--test/glyph-cache-pressure.c10
-rw-r--r--test/operator-clear.c9
-rw-r--r--test/operator-source.c9
-rw-r--r--test/select-font-face.c11
-rw-r--r--test/show-glyphs-many.c9
-rw-r--r--test/show-text-current-point.c10
-rw-r--r--test/text-antialias-gray.c5
-rw-r--r--test/text-antialias-none.c5
-rw-r--r--test/text-antialias-subpixel.c8
-rw-r--r--test/text-pattern.c9
-rw-r--r--test/text-rotate.c3
-rw-r--r--test/unbounded-operator.c9
18 files changed, 19 insertions, 116 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c
index ea580bed..0bda5609 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1481,6 +1481,7 @@ cairo_test_for_target (cairo_test_t *test,
char *format;
cairo_test_status_t ret;
cairo_content_t expected_content;
+ cairo_font_options_t *font_options;
/* Get the strings ready that we'll need. */
format = _cairo_test_content_name (target->content);
@@ -1567,6 +1568,15 @@ cairo_test_for_target (cairo_test_t *test,
cairo_paint (cr);
cairo_restore (cr);
+ /* Set all components of font_options to avoid backend differences
+ * and reduce number of needed reference images. */
+ font_options = cairo_font_options_create ();
+ cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_ON);
+ cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
+ cairo_set_font_options (cr, font_options);
+ cairo_font_options_destroy (font_options);
+
status = (test->draw) (cr, test->width, test->height);
/* Then, check all the different ways it could fail. */
diff --git a/test/clip-operator.c b/test/clip-operator.c
index 52cbba61..4d262f85 100644
--- a/test/clip-operator.c
+++ b/test/clip-operator.c
@@ -144,7 +144,6 @@ draw (cairo_t *cr, int width, int height)
{
int j, x, y;
cairo_operator_t op;
- cairo_font_options_t *font_options;
cairo_pattern_t *pattern;
cairo_select_font_face (cr, "Bitstream Vera Sans",
@@ -152,14 +151,6 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 0.9 * HEIGHT);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
for (op = CAIRO_OPERATOR_CLEAR; op < N_OPERATORS; op++) {
x = op * (WIDTH + PAD) + PAD;
diff --git a/test/font-matrix-translation.c b/test/font-matrix-translation.c
index dbdeb873..067cbb5b 100644
--- a/test/font-matrix-translation.c
+++ b/test/font-matrix-translation.c
@@ -64,7 +64,6 @@ box_text (cairo_t *cr, const char *utf8, double x, double y)
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_font_options_t *font_options;
cairo_text_extents_t extents;
cairo_matrix_t matrix;
@@ -76,14 +75,6 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_translate (cr, PAD, PAD);
cairo_set_line_width (cr, 1.0);
diff --git a/test/ft-font-create-for-ft-face.c b/test/ft-font-create-for-ft-face.c
index 64a32241..066b175d 100644
--- a/test/ft-font-create-for-ft-face.c
+++ b/test/ft-font-create-for-ft-face.c
@@ -80,6 +80,8 @@ draw (cairo_t *cr, int width, int height)
font_options = cairo_font_options_create ();
+ cairo_get_font_options (cr, font_options);
+
scaled_font = cairo_scaled_font_create (font_face,
&font_matrix,
&ctm,
diff --git a/test/ft-text-antialias-none.c b/test/ft-text-antialias-none.c
index 55a6fa3c..e4a34e96 100644
--- a/test/ft-text-antialias-none.c
+++ b/test/ft-text-antialias-none.c
@@ -55,8 +55,7 @@ create_scaled_font (cairo_t * cr)
font_options = cairo_font_options_create ();
- /* disable hinting */
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_get_font_options (cr, font_options);
pattern = FcPatternCreate ();
diff --git a/test/ft-text-vertical-layout.c b/test/ft-text-vertical-layout.c
index d7638eee..334fe601 100644
--- a/test/ft-text-vertical-layout.c
+++ b/test/ft-text-vertical-layout.c
@@ -55,10 +55,7 @@ create_scaled_font (cairo_t * cr)
font_options = cairo_font_options_create ();
- /* disable hinting */
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
- /* enable antialias and override screen settings */
- cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
+ cairo_get_font_options (cr, font_options);
pattern = FcPatternCreate ();
diff --git a/test/glyph-cache-pressure.c b/test/glyph-cache-pressure.c
index 5b5e6c45..ba90fa36 100644
--- a/test/glyph-cache-pressure.c
+++ b/test/glyph-cache-pressure.c
@@ -61,8 +61,6 @@ cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_font_options_t *font_options;
-
/* We draw in the default black, so paint white first. */
cairo_save (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
@@ -76,14 +74,6 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
cairo_move_to (cr, 1, TEXT_SIZE);
diff --git a/test/operator-clear.c b/test/operator-clear.c
index 575ce1d0..ea9fcf8f 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -159,21 +159,12 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, j, x, y;
- cairo_font_options_t *font_options;
cairo_pattern_t *pattern;
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
x = i * (WIDTH + PAD) + PAD;
diff --git a/test/operator-source.c b/test/operator-source.c
index 6784622e..4bea7935 100644
--- a/test/operator-source.c
+++ b/test/operator-source.c
@@ -198,21 +198,12 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, j, x, y;
- cairo_font_options_t *font_options;
cairo_pattern_t *pattern;
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
x = i * (WIDTH + PAD) + PAD;
diff --git a/test/select-font-face.c b/test/select-font-face.c
index 30daf25d..57120ca1 100644
--- a/test/select-font-face.c
+++ b/test/select-font-face.c
@@ -39,23 +39,12 @@ cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_font_options_t *font_options;
-
/* We draw in the default black, so paint white first. */
cairo_save (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
cairo_paint (cr);
cairo_restore (cr);
- font_options = cairo_font_options_create ();
-
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
- cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
- cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
cairo_select_font_face (cr, "Bitstream Vera Serif",
diff --git a/test/show-glyphs-many.c b/test/show-glyphs-many.c
index f9137e6c..9931a259 100644
--- a/test/show-glyphs-many.c
+++ b/test/show-glyphs-many.c
@@ -91,7 +91,6 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_glyph_t glyphs[NUM_GLYPHS];
- cairo_font_options_t *font_options;
int i;
/* Initialize our giant array of glyphs. */
@@ -110,14 +109,6 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_show_glyphs (cr, glyphs, NUM_GLYPHS);
return CAIRO_TEST_SUCCESS;
diff --git a/test/show-text-current-point.c b/test/show-text-current-point.c
index ebd36445..5ff36758 100644
--- a/test/show-text-current-point.c
+++ b/test/show-text-current-point.c
@@ -39,8 +39,6 @@ cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_font_options_t *font_options;
-
/* We draw in the default black, so paint white first. */
cairo_save (cr);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
@@ -52,14 +50,6 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
cairo_move_to (cr, 0, TEXT_SIZE);
diff --git a/test/text-antialias-gray.c b/test/text-antialias-gray.c
index 0c9f30dd..8090d8e0 100644
--- a/test/text-antialias-gray.c
+++ b/test/text-antialias-gray.c
@@ -57,12 +57,9 @@ draw (cairo_t *cr, int width, int height)
cairo_set_font_size (cr, TEXT_SIZE);
font_options = cairo_font_options_create ();
-
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_get_font_options (cr, font_options);
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
-
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);
diff --git a/test/text-antialias-none.c b/test/text-antialias-none.c
index 32f7a0ed..f9c86a9a 100644
--- a/test/text-antialias-none.c
+++ b/test/text-antialias-none.c
@@ -57,12 +57,9 @@ draw (cairo_t *cr, int width, int height)
cairo_set_font_size (cr, TEXT_SIZE);
font_options = cairo_font_options_create ();
-
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_get_font_options (cr, font_options);
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_NONE);
-
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);
diff --git a/test/text-antialias-subpixel.c b/test/text-antialias-subpixel.c
index aba98908..af0112a8 100644
--- a/test/text-antialias-subpixel.c
+++ b/test/text-antialias-subpixel.c
@@ -53,16 +53,12 @@ draw (cairo_t *cr, int width, int height)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
- /* Sub-pixel antialiasing with unhinted glyphs can be pretty ugly
- * (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_get_font_options (cr, font_options);
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);
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
diff --git a/test/text-pattern.c b/test/text-pattern.c
index 40a2a454..02feb228 100644
--- a/test/text-pattern.c
+++ b/test/text-pattern.c
@@ -40,17 +40,8 @@ cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_font_options_t *font_options;
cairo_pattern_t *pat;
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
diff --git a/test/text-rotate.c b/test/text-rotate.c
index abc6baa5..50d907b2 100644
--- a/test/text-rotate.c
+++ b/test/text-rotate.c
@@ -110,9 +110,8 @@ draw (cairo_t *cr, int width, int height)
font_options = cairo_font_options_create ();
- cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
+ cairo_get_font_options (cr, font_options);
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
- cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
cairo_set_font_options (cr, font_options);
cairo_font_options_destroy (font_options);
diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c
index 70dab83f..d3a6f354 100644
--- a/test/unbounded-operator.c
+++ b/test/unbounded-operator.c
@@ -145,21 +145,12 @@ static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, j, x, y;
- cairo_font_options_t *font_options;
cairo_pattern_t *pattern;
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- 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_GRAY);
-
- cairo_set_font_options (cr, font_options);
- cairo_font_options_destroy (font_options);
-
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
for (i = 0; i < ARRAY_SIZE (operators); i++) {
x = i * (WIDTH + PAD) + PAD;