summaryrefslogtreecommitdiff
path: root/test/user-font.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-05-13 11:42:23 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-05-13 14:07:42 -0400
commitf68fb2c747afd45252a333260cdb3bf9986d4a94 (patch)
tree631a2bb12a57791842da88d89ee5d3e6eea174e2 /test/user-font.c
parent569cc3041195db9408c9c6531dc35b6f77434a25 (diff)
downloadcairo-f68fb2c747afd45252a333260cdb3bf9986d4a94.tar.gz
[test/user-font] Add some more glyphs
The glyph for 'z' now reveals a bug in PDF type1 code.
Diffstat (limited to 'test/user-font.c')
-rw-r--r--test/user-font.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/test/user-font.c b/test/user-font.c
index 3cdf7bc91..ef4228427 100644
--- a/test/user-font.c
+++ b/test/user-font.c
@@ -34,9 +34,9 @@
#define BORDER 10
#define TEXT_SIZE 64
-#define WIDTH (TEXT_SIZE * 9.75 + 2*BORDER)
+#define WIDTH (TEXT_SIZE * 15 + 2*BORDER)
#define HEIGHT ((TEXT_SIZE + 2*BORDER)*2)
-#define TEXT "cairo user font"
+#define TEXT "geez... cairo user-font"
static cairo_test_draw_function_t draw;
@@ -51,6 +51,10 @@ cairo_test_t test = {
draw
};
+#define END_GLYPH 0
+#define STROKE 126
+#define CLOSE 127
+
/* Simple glyph definition: 1 - 15 means lineto (or moveto for first
* point) for one of the points on this grid:
*
@@ -61,32 +65,31 @@ cairo_test_t test = {
* 13 14 15
*/
-#define END_GLYPH 0
-#define STROKE 13
-#define CLOSE 14
-
static const struct {
unsigned long ucs4;
int width;
char data[16];
} glyphs [] = {
- { -1 , 0, { END_GLYPH } },
+ { '\0', 0, { END_GLYPH } },
{ ' ', 1, { END_GLYPH } },
- { 'c', 3, { 6, 4, 10, 12, STROKE, END_GLYPH } },
+ { '-', 2, { 7, 8, STROKE, END_GLYPH } },
+ { '.', 1, { 10, 10, STROKE, END_GLYPH } },
{ 'a', 3, { 4, 6, 12, 10, 7, 8, STROKE, END_GLYPH } },
+ { 'c', 3, { 6, 4, 10, 12, STROKE, END_GLYPH } },
+ { 'e', 3, { 12, 10, 4, 6, 9, 7, STROKE, END_GLYPH } },
+ { 'f', 3, { 3, 2, 11, STROKE, 4, 6, STROKE, END_GLYPH } },
+ { 'g', 3, { 12, 10, 4, 6, 15, 13, STROKE, END_GLYPH } },
+ { 'h', 3, { 1, 10, STROKE, 7, 5, 6, 12, STROKE, END_GLYPH } },
{ 'i', 1, { 1, 1, STROKE, 4, 10, STROKE, END_GLYPH } },
- { 'r', 3, { 4, 10, STROKE, 7, 5, 6, STROKE, END_GLYPH } },
+ { 'l', 1, { 1, 10, STROKE, END_GLYPH } },
+ { 'n', 3, { 10, 4, STROKE, 7, 5, 6, 12, STROKE, END_GLYPH } },
{ 'o', 3, { 4, 10, 12, 6, CLOSE, END_GLYPH } },
- { 'u', 3, { 4, 10, 12, 6, STROKE, END_GLYPH } },
+ { 'r', 3, { 4, 10, STROKE, 7, 5, 6, STROKE, END_GLYPH } },
{ 's', 3, { 6, 4, 7, 9, 12, 10, STROKE, END_GLYPH } },
- { 'e', 3, { 12, 10, 4, 6, 9, 8, STROKE, END_GLYPH } },
- { 'f', 3, { 3, 2, 11, STROKE, 4, 6, STROKE, END_GLYPH } },
- { 'n', 3, { 10, 4, STROKE, 7, 5, 6, 12, STROKE, END_GLYPH } },
{ 't', 3, { 2, 11, 12, STROKE, 4, 6, STROKE, END_GLYPH } },
- { 'h', 3, { 1, 10, STROKE, 7, 5, 6, 12, STROKE, END_GLYPH } },
- { 'l', 1, { 1, 10, STROKE, END_GLYPH } },
- { '-', 2, { 7, 8, STROKE, END_GLYPH } },
- { '\0', 0, { END_GLYPH } },
+ { 'u', 3, { 4, 10, 12, 6, STROKE, END_GLYPH } },
+ { 'z', 3, { 4, 6, 10, 12, STROKE, END_GLYPH } },
+ { -1, 0, { END_GLYPH } },
};
static cairo_status_t
@@ -105,7 +108,7 @@ test_scaled_font_unicode_to_glyph (cairo_scaled_font_t *scaled_font,
{
int i;
- for (i = 0; glyphs[i].ucs4 != '\0'; i++)
+ for (i = 0; glyphs[i].ucs4 != -1; i++)
if (glyphs[i].ucs4 == unicode) {
*glyph = i;
return CAIRO_STATUS_SUCCESS;