[cairo-commit] 7 commits - configure.ac src/cairo-font-face-twin.c test/ft-show-glyphs-positioning.c test/Makefile.am test/Makefile.sources test/twin-antialias-gray.c test/twin-antialias-gray.ref.png test/twin-antialias-gray.xlib.ref.png test/twin-antialias-mixed.c test/twin-antialias-mixed.ref.png test/twin-antialias-mixed.xlib.ref.png test/twin-antialias-none.c test/twin-antialias-none.ref.png test/twin-antialias-none.xlib.ref.png test/twin-antialias-subpixel.c test/twin-antialias-subpixel.ref.png test/twin-antialias-subpixel.xlib.ref.png
Chris Wilson
ickle at kemper.freedesktop.org
Wed Sep 9 01:54:01 PDT 2009
configure.ac | 2
src/cairo-font-face-twin.c | 2
test/Makefile.am | 8 ++
test/Makefile.sources | 4 +
test/ft-show-glyphs-positioning.c | 46 ++++++++++++--
test/twin-antialias-gray.c | 71 +++++++++++++++++++++
test/twin-antialias-gray.ref.png |binary
test/twin-antialias-gray.xlib.ref.png |binary
test/twin-antialias-mixed.c | 97 ++++++++++++++++++++++++++++++
test/twin-antialias-mixed.ref.png |binary
test/twin-antialias-mixed.xlib.ref.png |binary
test/twin-antialias-none.c | 71 +++++++++++++++++++++
test/twin-antialias-none.ref.png |binary
test/twin-antialias-none.xlib.ref.png |binary
test/twin-antialias-subpixel.c | 71 +++++++++++++++++++++
test/twin-antialias-subpixel.ref.png |binary
test/twin-antialias-subpixel.xlib.ref.png |binary
17 files changed, 364 insertions(+), 8 deletions(-)
New commits:
commit 610b311a970877f3954ba829cf43caecce0ab72c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 09:48:24 2009 +0100
[test] Variation of twin that intermixes antialiasing
Check that we are substituting the right glyph depth and changing masks
appropriately.
diff --git a/test/Makefile.am b/test/Makefile.am
index c03b7bf..b3c9809 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -979,6 +979,8 @@ REFERENCE_IMAGES = \
twin-antialias-gray.xlib.ref.png \
twin-antialias-none.ref.png \
twin-antialias-none.xlib.ref.png \
+ twin-antialias-mixed.ref.png \
+ twin-antialias-mixed.xlib.ref.png \
twin-antialias-subpixel.ref.png \
twin-antialias-subpixel.xlib.ref.png \
unantialiased-shapes.quartz.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 37762e0..00fbf3f 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -218,6 +218,7 @@ test_sources = \
trap-clip.c \
twin.c \
twin-antialias-gray.c \
+ twin-antialias-mixed.c \
twin-antialias-none.c \
twin-antialias-subpixel.c \
unantialiased-shapes.c \
diff --git a/test/twin-antialias-mixed.c b/test/twin-antialias-mixed.c
new file mode 100644
index 0000000..43f58ce
--- /dev/null
+++ b/test/twin-antialias-mixed.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2009 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 <chris at chris-wilson.co.uk>
+ */
+
+#include "cairo-test.h"
+
+static cairo_scaled_font_t *
+create_twin (cairo_t *cr, cairo_antialias_t antialias)
+{
+ cairo_font_options_t *options;
+
+ 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, antialias);
+ cairo_set_font_options (cr, options);
+ cairo_font_options_destroy (options);
+
+ return cairo_scaled_font_reference (cairo_get_scaled_font (cr));
+}
+
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_scaled_font_t *subpixel, *gray, *none;
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ cairo_set_font_size (cr, 16);
+ subpixel = create_twin (cr, CAIRO_ANTIALIAS_SUBPIXEL);
+ gray = create_twin (cr, CAIRO_ANTIALIAS_GRAY);
+ none = create_twin (cr, CAIRO_ANTIALIAS_NONE);
+
+ cairo_move_to (cr, 4, 14);
+ cairo_set_scaled_font (cr, subpixel);
+ cairo_show_text (cr, "Is cairo's");
+ cairo_set_scaled_font (cr, gray);
+ cairo_show_text (cr, " twin");
+ cairo_set_scaled_font (cr, none);
+ cairo_show_text (cr, " giza?");
+
+ cairo_move_to (cr, 4, 34);
+ cairo_set_scaled_font (cr, gray);
+ cairo_show_text (cr, "Is cairo's");
+ cairo_set_scaled_font (cr, none);
+ cairo_show_text (cr, " twin");
+ cairo_set_scaled_font (cr, subpixel);
+ cairo_show_text (cr, " giza?");
+
+ cairo_move_to (cr, 4, 54);
+ cairo_set_scaled_font (cr, none);
+ cairo_show_text (cr, "Is cairo's");
+ cairo_set_scaled_font (cr, gray);
+ cairo_show_text (cr, " twin");
+ cairo_set_scaled_font (cr, subpixel);
+ cairo_show_text (cr, " giza?");
+
+ cairo_scaled_font_destroy (none);
+ cairo_scaled_font_destroy (gray);
+ cairo_scaled_font_destroy (subpixel);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (twin_antialias_mixed,
+ "Tests the internal font (with intermixed antialiasing)",
+ "twin, font", /* keywords */
+ NULL, /* requirements */
+ 140, 60,
+ NULL, draw)
diff --git a/test/twin-antialias-mixed.ref.png b/test/twin-antialias-mixed.ref.png
new file mode 100644
index 0000000..67cfc5c
Binary files /dev/null and b/test/twin-antialias-mixed.ref.png differ
diff --git a/test/twin-antialias-mixed.xlib.ref.png b/test/twin-antialias-mixed.xlib.ref.png
new file mode 100644
index 0000000..3263f7c
Binary files /dev/null and b/test/twin-antialias-mixed.xlib.ref.png differ
commit c218ff8cbec2cc7aa3efc4c7f7d8690fbdec5e9a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 09:52:18 2009 +0100
[test] SUBPIXEL_ANTIALIAS varation of twin
Force argb32 glyphs.
diff --git a/test/Makefile.am b/test/Makefile.am
index 52023c0..c03b7bf 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -979,6 +979,8 @@ REFERENCE_IMAGES = \
twin-antialias-gray.xlib.ref.png \
twin-antialias-none.ref.png \
twin-antialias-none.xlib.ref.png \
+ twin-antialias-subpixel.ref.png \
+ twin-antialias-subpixel.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 5813b11..37762e0 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -219,6 +219,7 @@ test_sources = \
twin.c \
twin-antialias-gray.c \
twin-antialias-none.c \
+ twin-antialias-subpixel.c \
unantialiased-shapes.c \
unbounded-operator.c \
user-data.c \
diff --git a/test/twin-antialias-subpixel.c b/test/twin-antialias-subpixel.c
new file mode 100644
index 0000000..8ecc0fc
--- /dev/null
+++ b/test/twin-antialias-subpixel.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 <chris at chris-wilson.co.uk>
+ */
+
+#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_SUBPIXEL);
+
+ 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_SUBPIXEL);
+ 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_subpixel,
+ "Tests the internal font (with subpixel antialiasing)",
+ "twin, font", /* keywords */
+ NULL, /* requirements */
+ 140, 60,
+ NULL, draw)
diff --git a/test/twin-antialias-subpixel.ref.png b/test/twin-antialias-subpixel.ref.png
new file mode 100644
index 0000000..ffaa57c
Binary files /dev/null and b/test/twin-antialias-subpixel.ref.png differ
diff --git a/test/twin-antialias-subpixel.xlib.ref.png b/test/twin-antialias-subpixel.xlib.ref.png
new file mode 100644
index 0000000..c8a79f4
Binary files /dev/null and b/test/twin-antialias-subpixel.xlib.ref.png differ
commit 456484514f4dacfe95952e8c0b73eb6a9a1a9d27
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 09:38:18 2009 +0100
[test] Variation of twin with ANTIALIAS_GRAY
Force generation of a8 glyphs.
diff --git a/test/Makefile.am b/test/Makefile.am
index 5ef098f..52023c0 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-gray.ref.png \
+ twin-antialias-gray.xlib.ref.png \
twin-antialias-none.ref.png \
twin-antialias-none.xlib.ref.png \
unantialiased-shapes.quartz.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 2a9b05f..5813b11 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-gray.c \
twin-antialias-none.c \
unantialiased-shapes.c \
unbounded-operator.c \
diff --git a/test/twin-antialias-gray.c b/test/twin-antialias-gray.c
new file mode 100644
index 0000000..d62efcd
--- /dev/null
+++ b/test/twin-antialias-gray.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 <chris at chris-wilson.co.uk>
+ */
+
+#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_GRAY);
+
+ 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_GRAY);
+ 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_gray,
+ "Tests the internal font (with antialiasing reduced)",
+ "twin, font", /* keywords */
+ NULL, /* requirements */
+ 140, 60,
+ NULL, draw)
diff --git a/test/twin-antialias-gray.ref.png b/test/twin-antialias-gray.ref.png
new file mode 100644
index 0000000..ffaa57c
Binary files /dev/null and b/test/twin-antialias-gray.ref.png differ
diff --git a/test/twin-antialias-gray.xlib.ref.png b/test/twin-antialias-gray.xlib.ref.png
new file mode 100644
index 0000000..c8a79f4
Binary files /dev/null and b/test/twin-antialias-gray.xlib.ref.png differ
commit 8555984b8e72ab5846783ed54afa1a857d70f241
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 09:29:42 2009 +0100
[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.
diff --git a/test/Makefile.am b/test/Makefile.am
index d6bcb27..5ef098f 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 68672f5..2a9b05f 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 0000000..eaf8657
--- /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 <chris at chris-wilson.co.uk>
+ */
+
+#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 0000000..2151f46
Binary files /dev/null and b/test/twin-antialias-none.ref.png differ
diff --git a/test/twin-antialias-none.xlib.ref.png b/test/twin-antialias-none.xlib.ref.png
new file mode 100644
index 0000000..85fa6fc
Binary files /dev/null and b/test/twin-antialias-none.xlib.ref.png differ
commit 1820cb7fd648283a5b477fbc6bd654200ed190e6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 09:12:54 2009 +0100
[test] Check for errors during ft-show-glyphs-positioning
Do not blindly assume that we managed to construct a valid scaled-font
before attempting to dereference the FT_Face. Consider a machine with
no fonts which is substituting twin...
diff --git a/test/ft-show-glyphs-positioning.c b/test/ft-show-glyphs-positioning.c
index 2d39a0c..3092fc9 100644
--- a/test/ft-show-glyphs-positioning.c
+++ b/test/ft-show-glyphs-positioning.c
@@ -59,10 +59,11 @@ glyph_array_show (glyph_array_t *glyphs, cairo_t *cr)
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
-static void
+static cairo_status_t
glyph_array_add_text(glyph_array_t *glyphs, cairo_t *cr, const char *s, double spacing)
{
cairo_scaled_font_t *scaled_font;
+ cairo_status_t status;
FT_Face face;
unsigned long charcode;
unsigned int index;
@@ -73,7 +74,14 @@ glyph_array_add_text(glyph_array_t *glyphs, cairo_t *cr, const char *s, double s
int first = TRUE;
scaled_font = cairo_get_scaled_font (cr);
+ status = cairo_scaled_font_status (scaled_font);
+ if (status)
+ return status;
+
face = cairo_ft_scaled_font_lock_face (scaled_font);
+ if (face)
+ return CAIRO_STATUS_FONT_TYPE_MISMATCH;
+
p = s;
while (*p)
{
@@ -106,13 +114,16 @@ glyph_array_add_text(glyph_array_t *glyphs, cairo_t *cr, const char *s, double s
}
cairo_ft_scaled_font_unlock_face (scaled_font);
+ return CAIRO_STATUS_SUCCESS;
}
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
+ const cairo_test_context_t *ctx = cairo_test_get_context (cr);
glyph_array_t glyphs;
cairo_font_options_t *font_options;
+ cairo_status_t status;
/* paint white so we don't need separate ref images for
* RGB24 and ARGB32 */
@@ -133,19 +144,40 @@ draw (cairo_t *cr, int width, int height)
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
glyph_array_init (&glyphs, 1, TEXT_SIZE);
- glyph_array_add_text(&glyphs, cr, "AWAY again", 0.0);
+
+ status = glyph_array_add_text(&glyphs, cr, "AWAY again", 0.0);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_rel_move_to (&glyphs, TEXT_SIZE*1, 0.0);
- glyph_array_add_text(&glyphs, cr, "character space", TEXT_SIZE*0.3);
+ status = glyph_array_add_text(&glyphs, cr, "character space", TEXT_SIZE*0.3);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_show (&glyphs, cr);
+
glyph_array_init (&glyphs, 1, TEXT_SIZE*2 + 4);
- glyph_array_add_text(&glyphs, cr, "Increasing", 0.0);
+
+ status = glyph_array_add_text(&glyphs, cr, "Increasing", 0.0);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_rel_move_to (&glyphs, TEXT_SIZE*0.5, 0.0);
- glyph_array_add_text(&glyphs, cr, "space", 0.0);
+ status = glyph_array_add_text(&glyphs, cr, "space", 0.0);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_rel_move_to (&glyphs, TEXT_SIZE*1.0, 0.0);
- glyph_array_add_text(&glyphs, cr, "between", 0.0);
+ status = glyph_array_add_text(&glyphs, cr, "between", 0.0);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_rel_move_to (&glyphs, TEXT_SIZE*1.5, 0.0);
- glyph_array_add_text(&glyphs, cr, "words", 0.0);
+ status = glyph_array_add_text(&glyphs, cr, "words", 0.0);
+ if (status)
+ return cairo_test_status_from_status (ctx, status);
+
glyph_array_show (&glyphs, cr);
return CAIRO_TEST_SUCCESS;
commit 7fb0d5e2091a09ef7b01574f4ecf87236ef43fec
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 01:45:16 2009 +0100
[twin] Initialise all properties
Left a couple of uninitialised properties along the non-toy font
construction path.
diff --git a/src/cairo-font-face-twin.c b/src/cairo-font-face-twin.c
index 3f82733..56ebaea 100644
--- a/src/cairo-font-face-twin.c
+++ b/src/cairo-font-face-twin.c
@@ -294,6 +294,8 @@ twin_font_face_create_properties (cairo_font_face_t *twin_face,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
props->stretch = TWIN_STRETCH_NORMAL;
+ props->slant = CAIRO_FONT_SLANT_NORMAL;
+ props->weight = TWIN_WEIGHT_NORMAL;
props->monospace = FALSE;
props->smallcaps = FALSE;
commit 34778a883af806f77d0c89c85cebb315b43d7ef2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Sep 9 01:16:08 2009 +0100
[configure] Typo in test
The have_dl clause was meant to have been removed from the requirements
test for cairo-script-interpreter. Instead we left the test broken.
diff --git a/configure.ac b/configure.ac
index 985ea71..cb06481 100644
--- a/configure.ac
+++ b/configure.ac
@@ -653,7 +653,7 @@ CAIRO_ENABLE(trace, cairo-trace, yes, [
])
CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
- if test "x$have_libz" != "xyes" "x$have_dl" != "xyes"; then
+ if test "x$have_libz" != "xyes"; then
use_interpreter="no (requires zlib)"
fi
])
More information about the cairo-commit
mailing list