[cairo-commit] cairo/test text-rotate-ref.png, NONE, 1.1 text-rotate.c, 1.10, 1.11

Carl Worth commit at pdx.freedesktop.org
Tue Aug 23 10:11:18 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv28215/test

Modified Files:
	text-rotate.c 
Added Files:
	text-rotate-ref.png 
Log Message:

2005-08-23  Carl Worth  <cworth at cworth.org>

        * test/text-rotate-ref.png:
        * test/text-rotate.c: (draw), (main): Add more comments on the
        improved state of this bug. Commit a reference image generated
        with cairo_text_path; cairo_fill. (We may not require getting this
        exact result, but I think it is worth examining the differences
        closely.)


--- NEW FILE: text-rotate-ref.png ---
(This appears to be a binary file; contents omitted.)

Index: text-rotate.c
===================================================================
RCS file: /cvs/cairo/cairo/test/text-rotate.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- text-rotate.c	22 Aug 2005 15:45:46 -0000	1.10
+++ text-rotate.c	23 Aug 2005 17:11:16 -0000	1.11
@@ -42,7 +42,7 @@
  *
  * 2004-11-03 Carl Worth <cworth at cworth.org>
  *
- *   Looks like the major problems with this bg appeared in the great
+ *   Looks like the major problems with this bug appeared in the great
  *   font rework between 0.1.23 and 0.2.0. And it looks like we need
  *   to fix the regression test suite to test the xlib target (since
  *   the bug does not show up in the png backend).
@@ -55,6 +55,26 @@
  *   text--a new version of freetype will change everything. We may
  *   need to add a simple backend for stroked fonts and add a simple
  *   builtin font to cairo for pixel-perfect tests with text.
+ *
+ * 2005-08-23
+ *
+ *   It appears that the worst placement and glyph selection problems
+ *   have now been resolved. In the past some letters were noticeably
+ *   of a different size at some rotations, and there was a lot of
+ *   drift away from the baseline. These problems do not appear
+ *   anymore.
+ *
+ *   Another thing that helps is that we now have font options which
+ *   we can use to disable hinting in order to get more repeatable
+ *   results. I'm doing that in this test now.
+ *
+ *   There are still some subtle positioning problems which I'm
+ *   assuming are due to the lack of finer-than-whole-pixel glyph
+ *   positioning. I'm generating a reference image now by replacing
+ *   cairo_show_text with cairo_text_path; cairo_fill. This will let
+ *   us look more closely at the remaining positioning problems. (In
+ *   particular, I want to make sure we're rounding as well as
+ *   possible).
  */
 
 #include "cairo-test.h"
@@ -76,6 +96,7 @@
 {
     int i, x_off, y_off;
     cairo_text_extents_t extents;
+    cairo_font_options_t *font_options;
     static char text[] = "cairo";
 
     cairo_select_font_face (cr, "Bitstream Vera Sans",
@@ -83,6 +104,15 @@
 			    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_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);
 
     cairo_translate (cr, WIDTH/2.0, HEIGHT/2.0);
@@ -105,7 +135,12 @@
 	cairo_stroke (cr);
 	cairo_move_to (cr, x_off - extents.x_bearing, y_off - extents.y_bearing);
 	cairo_set_source_rgb (cr, 0, 0, 0);
+#if CAIRO_TEST_GENERATE_REFERENCE_IMAGE
+	cairo_text_path (cr, "cairo");
+	cairo_fill (cr);
+#else
 	cairo_show_text (cr, "cairo");
+#endif
 	cairo_restore (cr);
     }
 
@@ -116,5 +151,5 @@
 main (void)
 {
     return cairo_test_expect_failure (&test, draw,
-				      "known bugs in positioning rotated glyphs");
+				      "minor bugs in positioning rotated glyphs");
 }



More information about the cairo-commit mailing list