From f0d7e3f858858937168c6cfdfae12dbe751ee683 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 9 May 2006 14:15:27 -0700 Subject: [PATCH] Add select-font-face test for whosing multiple faces at once. --- test/.gitignore | 1 + test/Makefile.am | 2 + test/select-font-face-ref.png | Bin 0 -> 2460 bytes test/select-font-face.c | 83 ++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 test/select-font-face-ref.png create mode 100644 test/select-font-face.c diff --git a/test/.gitignore b/test/.gitignore index c3a021824..c0881dcb6 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -71,6 +71,7 @@ pthread-show-text rectangle-rounding-error rel-path scale-source-surface-paint +select-font-face select-font-no-show-text self-copy self-intersecting diff --git a/test/Makefile.am b/test/Makefile.am index 90b5a9c08..b7b440a44 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -48,6 +48,7 @@ pattern-get-type \ pixman-rotate \ rectangle-rounding-error \ scale-source-surface-paint \ +select-font-face \ select-font-no-show-text \ self-copy \ self-intersecting \ @@ -205,6 +206,7 @@ romedalen.png \ scale-source-surface-paint-ref.png \ scale-source-surface-paint-rgb24-ref.png \ scale-source-surface-paint-pdf-argb32-ref.png \ +select-font-face-ref.png \ self-copy-ref.png \ self-intersecting-ref.png \ self-intersecting-rgb24-ref.png \ diff --git a/test/select-font-face-ref.png b/test/select-font-face-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..a4d0670d765b4d5cf6c8f7c28f58b9a699123055 GIT binary patch literal 2460 zcmWlb2|QHo7sp4k)MFm@F}Ok|9)WKfuV21D~A zYbr~UY>_2I)<0?NV;ldcdq4MiKA&ef_dMsE-}l~R8!Iz@J{dj;1j3Inhuea_2|Pl) z+@LKdi|d1q+tbnv4mtXB7dBIgV1x&UK$-9ibDa>oESZ=!S_6Tc&_}=x(LN7<94sJ}xqv{VW^etnZILXKL^{eG&WjjAr7ieyRH|Ujw>) z;g7i2R30_hT(U^=xp_QFPPNd_u+LE0@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w1J9Kmmv)7QW*>)$OJ@;j|*Z^B9dVA(5R@Y@kH?Kk~zlBEiErEZz4-k zT|Iql%(?8)fBYP=>mDBeXH#dIyzWFXwiP35nptyDN z1t5Zgf&dn#F){i(s}n?lAU2zww7}Na&WzyM$m*U0oLb-LHL!DV==kOqi;9fYU0YjI z_1a!=DuDH-rlyi}Bx>(YS>f^85K#prWbcb9fV!iy#8OaecekH;xXwDR)UFIY;;-ee zmAA>k-v9k}jmb>!;16{ODwVDJaao36hG6RJ)_^;K$K%mT;(hp7y_0+U*f;kc0;Y?I zh>X+*$O_8q7r%J%Xo!XZbx=m5edz5KT+~IE6c-DfI;CGe@`bs*UE7%75Vflb7(W1~ zTn+A6C9G>s#vX1-QYe(LurMJ>$a%C_v9QvKit$*z(rd}O)bqW_D~#pyr`&1>Thn{`%zKX z3=Wu_2n3>OXEG9v!3=)=3f6Li`HWEZ!S44)d|Ga<3;^bbROyQ&jN5{Jcryx-=!NG3 z92tFcA7*cFkHh2b?Csl2QF%7BA&@3_bt!WTix;J(kAXPA5v>djABy!34iZs$S{!|E zxv%@;Lqe*7XHe@PIQ)+<$O3&if@vI`uJ-QTJL6&9pTK3{-(>iLTtj2yoq&Lns;czD z!a|Qu-0aemtHJZk*)CCKiNF4+rNp*6e8XFx&GJgj1;~<6ac%>y0#+E)hQ^xPu$P1C zpC9h;5Hm8~uTC`9NA9S))CGowbIu{piGFEGV_6c9rYOc26&>wXM(^=n9=CjYO0RH!x&t@Ad-Q{S zxc_l3i298{7s=~+-0o>u;UM@18*^hKUE+Wj)}+!jbYyw)J@28k6BBkoW$|26^6&o0 TD{cyYt{?~#D|n@m`=kE@1%Srr literal 0 HcmV?d00001 diff --git a/test/select-font-face.c b/test/select-font-face.c new file mode 100644 index 000000000..50a28ff91 --- /dev/null +++ b/test/select-font-face.c @@ -0,0 +1,83 @@ +/* + * Copyright © 2006 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Carl D. Worth + */ + +#include "cairo-test.h" + +#define TEXT_SIZE 12 + +cairo_test_t test = { + "select-font-face", + "Tests using cairo_select_font_face to draw text in different faces", + 188, TEXT_SIZE + 4 +}; + +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_style (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", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size (cr, TEXT_SIZE); + + cairo_move_to (cr, 0, TEXT_SIZE); + cairo_show_text (cr, "i-am-serif"); + + cairo_select_font_face (cr, "Bitstream Vera Sans", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + cairo_show_text (cr, " i-am-sans"); + + cairo_select_font_face (cr, "Bitstream Vera Sans Mono", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + cairo_show_text (cr, " i-am-mono"); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +}