get-path-extents: Use APPROX_EQUALS instead of EQUALS for text path tests

This is done grudgingly due to freetype rounding the coordinates
of the extents when hinting is enabled.
This commit is contained in:
Carl Worth 2008-02-28 16:33:51 -08:00
parent 50a6fe1a2a
commit 602489b150

View file

@ -314,9 +314,15 @@ draw (cairo_t *cr, int width, int height)
cairo_move_to (cr2, -extents.x_bearing, -extents.y_bearing);
cairo_text_path (cr2, string);
cairo_set_line_width (cr2, 2.0);
errors += !check_extents (phase, cr2, FILL, EQUALS, 0, 0, extents.width, extents.height);
errors += !check_extents (phase, cr2, STROKE, EQUALS, -1, -1, extents.width+2, extents.height+2);
errors += !check_extents (phase, cr2, PATH, EQUALS, 0, 0, extents.width, extents.height);
/* XXX: We'd like to be able to use EQUALS here, but currently
* when hinting is enabled freetype returns integer extents. See
* http://cairographics.org/todo */
errors += !check_extents (phase, cr2, FILL, APPROX_EQUALS,
0, 0, extents.width, extents.height);
errors += !check_extents (phase, cr2, STROKE, APPROX_EQUALS,
-1, -1, extents.width+2, extents.height+2);
errors += !check_extents (phase, cr2, PATH, APPROX_EQUALS,
0, 0, extents.width, extents.height);
cairo_new_path (cr2);
cairo_restore (cr2);