|
Packit |
324a5c |
/*
|
|
Packit |
324a5c |
* Copyright © 2008 Mozilla Corporation
|
|
Packit |
324a5c |
*
|
|
Packit |
324a5c |
* Permission to use, copy, modify, distribute, and sell this software
|
|
Packit |
324a5c |
* and its documentation for any purpose is hereby granted without
|
|
Packit |
324a5c |
* fee, provided that the above copyright notice appear in all copies
|
|
Packit |
324a5c |
* and that both that copyright notice and this permission notice
|
|
Packit |
324a5c |
* appear in supporting documentation, and that the name of
|
|
Packit |
324a5c |
* Mozilla Corporation not be used in advertising or publicity pertaining to
|
|
Packit |
324a5c |
* distribution of the software without specific, written prior
|
|
Packit |
324a5c |
* permission. Mozilla Corporation makes no representations about the
|
|
Packit |
324a5c |
* suitability of this software for any purpose. It is provided "as
|
|
Packit |
324a5c |
* is" without express or implied warranty.
|
|
Packit |
324a5c |
*
|
|
Packit |
324a5c |
* MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
Packit |
324a5c |
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
Packit |
324a5c |
* FITNESS, IN NO EVENT SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL,
|
|
Packit |
324a5c |
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
Packit |
324a5c |
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
Packit |
324a5c |
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
Packit |
324a5c |
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
Packit |
324a5c |
*
|
|
Packit |
324a5c |
* Authors: Jeff Muizelaar
|
|
Packit |
324a5c |
*/
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
#include "cairo-test.h"
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
static cairo_test_status_t
|
|
Packit |
324a5c |
draw (cairo_t *cr, int width, int height)
|
|
Packit |
324a5c |
{
|
|
Packit |
324a5c |
cairo_font_face_t *font_face;
|
|
Packit |
324a5c |
cairo_font_options_t *font_options;
|
|
Packit |
324a5c |
cairo_scaled_font_t *scaled_font;
|
|
Packit |
324a5c |
cairo_matrix_t identity;
|
|
Packit |
324a5c |
cairo_matrix_t zero;
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
cairo_matrix_init_identity(&identity);
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
zero = identity;
|
|
Packit |
324a5c |
cairo_matrix_scale(&zero, 0, 0);
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
font_face = cairo_get_font_face (cr);
|
|
Packit |
324a5c |
font_options = cairo_font_options_create ();
|
|
Packit |
324a5c |
cairo_get_font_options (cr, font_options);
|
|
Packit |
324a5c |
scaled_font = cairo_scaled_font_create (font_face,
|
|
Packit |
324a5c |
&identity,
|
|
Packit |
324a5c |
&zero,
|
|
Packit |
324a5c |
font_options);
|
|
Packit |
324a5c |
cairo_set_scaled_font (cr, scaled_font);
|
|
Packit |
324a5c |
cairo_show_text (cr, "Hello");
|
|
Packit |
324a5c |
cairo_scaled_font_destroy (scaled_font);
|
|
Packit |
324a5c |
cairo_font_options_destroy (font_options);
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
return cairo_test_status_from_status (cairo_test_get_context (cr),
|
|
Packit |
324a5c |
cairo_status(cr));
|
|
Packit |
324a5c |
}
|
|
Packit |
324a5c |
|
|
Packit |
324a5c |
CAIRO_TEST (scaled_font_zero_matrix,
|
|
Packit |
324a5c |
"Test that scaled fonts with a degenerate matrix work",
|
|
Packit |
324a5c |
"zero, matrix, degenerate, scaled-font", /* keywords */
|
|
Packit |
324a5c |
NULL, /* requirements */
|
|
Packit |
324a5c |
0, 0,
|
|
Packit |
324a5c |
NULL, draw)
|