/* * Copyright © 2010 Uli Schlachter. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Author: Uli Schlachter */ #include "cairo-test.h" #define TEXT_SIZE 12 #define SIZE ((1 << 14) + (1 << 13)) static cairo_test_status_t draw (cairo_t *cr, int width, int height) { int x, y; cairo_text_extents_t extents; const char text[] = "Hello World!"; /* 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); cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, TEXT_SIZE); cairo_text_extents (cr, text, &extents); for (x = -10; x < 20; x++) { for (y = -10; y < 20; y++) { cairo_move_to (cr, x << 10, y << 10); cairo_rel_move_to (cr, -extents.x_bearing, -extents.y_bearing); cairo_show_text (cr, text); } } return CAIRO_TEST_SUCCESS; } CAIRO_TEST (huge_glyph_coord1, "Test that huge glyph coordinates work", "TODO", /* keywords */ NULL, /* requirements */ SIZE, 100, NULL, draw) CAIRO_TEST (huge_glyph_coord2, "Test that huge glyph coordinates work", "TODO", /* keywords */ NULL, /* requirements */ 100, SIZE, NULL, draw)