From 8555984b8e72ab5846783ed54afa1a857d70f241 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Sep 2009 09:29:42 +0100 Subject: [PATCH] [test] Add ANTIALIAS_NONE variation of twin I'm off hunting bugs. By using twin with ANTIALIAS_NONE we can construct a1 glyph images independently of the native font system. --- test/Makefile.am | 2 + test/Makefile.sources | 1 + test/twin-antialias-none.c | 71 ++++++++++++++++++++++++++ test/twin-antialias-none.ref.png | Bin 0 -> 718 bytes test/twin-antialias-none.xlib.ref.png | Bin 0 -> 745 bytes 5 files changed, 74 insertions(+) create mode 100644 test/twin-antialias-none.c create mode 100644 test/twin-antialias-none.ref.png create mode 100644 test/twin-antialias-none.xlib.ref.png diff --git a/test/Makefile.am b/test/Makefile.am index d6bcb277c..5ef098f25 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -975,6 +975,8 @@ REFERENCE_IMAGES = \ twin.ref.png \ twin.svg.ref.png \ twin.xlib.ref.png \ + twin-antialias-none.ref.png \ + twin-antialias-none.xlib.ref.png \ unantialiased-shapes.quartz.ref.png \ unantialiased-shapes.ref.png \ unbounded-operator.gl.argb32.xfail.png \ diff --git a/test/Makefile.sources b/test/Makefile.sources index 68672f5fc..2a9b05fa4 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -217,6 +217,7 @@ test_sources = \ translate-show-surface.c \ trap-clip.c \ twin.c \ + twin-antialias-none.c \ unantialiased-shapes.c \ unbounded-operator.c \ user-data.c \ diff --git a/test/twin-antialias-none.c b/test/twin-antialias-none.c new file mode 100644 index 000000000..eaf865701 --- /dev/null +++ b/test/twin-antialias-none.c @@ -0,0 +1,71 @@ +/* + * Copyright 2008 Chris Wilson + * + * 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 + * Chris Wilson not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Chris Wilson makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL CHRIS WILSON 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: Chris Wilson + */ + +#include "cairo-test.h" + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_font_options_t *options; + + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_paint (cr); + cairo_set_source_rgb (cr, 0, 0, 0); + + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + cairo_select_font_face (cr, + "@cairo:", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + + options = cairo_font_options_create (); + cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_NONE); + cairo_set_font_options (cr, options); + cairo_font_options_destroy (options); + + cairo_set_font_size (cr, 16); + + cairo_move_to (cr, 4, 14); + cairo_show_text (cr, "Is cairo's twin giza?"); + + cairo_move_to (cr, 4, 34); + cairo_text_path (cr, "Is cairo's twin giza?"); + cairo_fill (cr); + + cairo_move_to (cr, 4, 54); + cairo_text_path (cr, "Is cairo's twin giza?"); + cairo_set_line_width (cr, 2/16.); + cairo_stroke (cr); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (twin_antialias_none, + "Tests the internal font (with antialiasing disabled)", + "twin, font", /* keywords */ + NULL, /* requirements */ + 140, 60, + NULL, draw) diff --git a/test/twin-antialias-none.ref.png b/test/twin-antialias-none.ref.png new file mode 100644 index 0000000000000000000000000000000000000000..2151f46347a19e88656f301913bf051cf8d208c4 GIT binary patch literal 718 zcmV;<0x|uGP)YN`3=W2r)6Vle zz~20P+5w=0AQb>XD!>?|*4jt>;ApLRUD|C3GOdHF^Sja^Fwk1-4{pQPivsBm=TCMe z4XclvslM9qP|)VrlQL~JEmUnz{dxVRo%VeRE*Zxwk4qTcRc?I#q;#jQL~gaxa@n|G z%Ing3o?KhOtkJkSF3y75uz#v3Qo7?-2}fdH@-AE#a;Q=WbRpDdSJJS4*KZ7ToH3WK zwe|Xt?k6QTLWg>~;}-1G2;Ie8S{A1#CW=jW#=-Q}xX(t^CRy`)XA;9c+;Lt?cj^Z4 zszdY7P;P-U<#nmAHuz(A#^@xaKU?-r1}5a6S-gdWS+)ffc$o$GS;$AqJAk`Wq`Un= zx+?&JQ~(6200>e65TpViNCjA`aftn(_o&7pWxRKcY^QP9@SQBhrL3DRXdDUyjRQ0e zGykY@!Iak}XdD!vaR_(ux;5th3yniQ=?}rC8i#|A!TuVDbeo%M9Hz~yXdHwSO$=xp z96;kx4`>{~8)zJSK;r=BAl(%JK`H=(Q~(6200>e65TpVu4bmEogV+9NjaW1eyT2#N zw_(*W{;*Ua-F<6>DBNONs&SY$d_v>USFl`!%VXi{&}v_$aiG=`H4bXYv~b9)_Ry+* z(S}})gQVFInmx_5_n1rT@07i$<6`%u>#|umczDYNEUC=m(zMl)bV`ih+TH7VQ;mbr zUCgDG1MzmDR$ifT2$;%piE=YSmT{>k8t=klH*n+Wj{~9HhGfAV>xH1JvXO-Z;OV0000007*qoM6N<$g75rM A9smFU literal 0 HcmV?d00001 diff --git a/test/twin-antialias-none.xlib.ref.png b/test/twin-antialias-none.xlib.ref.png new file mode 100644 index 0000000000000000000000000000000000000000..85fa6fcdc9e661e9da73f32f69328a26550abb91 GIT binary patch literal 745 zcmVmrnoxm+gbImW6P01yr(g&qK%6Bm@ExHPf_h z+e@s?&(jVF9|b7@3Q_>dAf=S9YpmONO6jcb)$-Ggq>SRy@0eHTSb38&#kX!FDWzPu z_^EUk0JM_wb=R6BEtz7??w5`UvL75WhoY%fx9&Q&3+#V$$HjFX%d|Xn6;0nzx?@&Se!g|=DxS5#IA$6z z2Bj59#wOWr-9*R8G*?owY}dKxFY8#%tgW)MyTb|nLAo6Sw~e_lNwvn5Z>Br454l+D zn1``&_27~)ZZJCz29)mH)W6HrnWs2UQfq-mu}mRWIOghhxLS~JFY~q-MPskDR1yoy z)%OBD%m(1r*Fs;$Z97b*y8tNN1wcUxfPxeN1t|auQUDaB0I0^HQ+~P;)j0U5#z72$ zKA#t7+!ycH)i?kd(=lA*ke`oTST4Tgi zr^sBwt#oMe6q`zBQ55CHsP@Ua>P)AHOJhgxyj8i(5W$6&T{ z2ws4BdrXZ3lc~(_|7N4EV|4ekd1bmVuU-J zb4T+yzW=@ry7a7LH{)y^wm0V0xnH=+n*rn4)i512W%@?ujv5EvvqEd6pN#I{V-2>$ z%xtzV;5I<+Lrej8^TThM#>L2Oi|N}bSI2jEs&R;l9%e`Bcx81K)i`vb8VB)#(p>-) bqyYQ@bgU}&ql!>500000NkvXXu0mjfV8dWb literal 0 HcmV?d00001