diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2006-07-20 23:09:09 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2006-07-20 23:09:09 +0000 |
commit | 406f2c0a523141829e14b98068e3905e6f89c3ac (patch) | |
tree | 9e6d1080df086c0d6c1f2f0f935578c5d3c47062 /rufl_test.c | |
parent | f08f15e06aed53db8270110c787ba91be2201b9d (diff) | |
download | librufl-406f2c0a523141829e14b98068e3905e6f89c3ac.tar.gz librufl-406f2c0a523141829e14b98068e3905e6f89c3ac.tar.bz2 |
Merge my local changes into head; I've been sitting on these for far too long.
This comprises:
1) Centralised internal font family / sized font lookup (rufl_find.c)
2) Methods to provide access to font and glyph metrics (rufl_metrics.c)
3) Glyph decomposition into path segments (rufl_decompose.c)
svn path=/trunk/rufl/; revision=2788
Diffstat (limited to 'rufl_test.c')
-rw-r--r-- | rufl_test.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rufl_test.c b/rufl_test.c index 843db1f..a72017f 100644 --- a/rufl_test.c +++ b/rufl_test.c @@ -12,6 +12,10 @@ static void try(rufl_code code, const char *context); +static int move_to(os_coord *to, void *user); +static int line_to(os_coord *to, void *user); +static int cubic_to(os_coord *control1, os_coord *control2, os_coord *to, + void *user); static void callback(void *context, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, @@ -26,6 +30,7 @@ int main(void) size_t char_offset; int x; int actual_x; + struct rufl_decomp_funcs funcs = { move_to, line_to, cubic_to }; int bbox[4]; try(rufl_init(), "rufl_init"); @@ -51,6 +56,9 @@ int main(void) printf("split: %i -> %i %i \"%s\"\n", x, actual_x, char_offset, utf8_test + char_offset); } + try(rufl_decompose_glyph("Homerton", rufl_WEIGHT_400, 1280, + "A", 1, &funcs, 0), + "rufl_decompose_glyph"); try(rufl_paint_callback("NewHall", rufl_WEIGHT_400, 240, utf8_test, sizeof utf8_test - 1, 1200, 1000, callback, 0), "rufl_paint_callback"); @@ -87,6 +95,34 @@ void try(rufl_code code, const char *context) } +int move_to(os_coord *to, void *user) +{ + printf("Move to (%d,%d)\n", to->x, to->y); + + return 0; +} + + +int line_to(os_coord *to, void *user) +{ + printf("Line to (%d,%d)\n", to->x, to->y); + + return 0; +} + + +int cubic_to(os_coord *control1, os_coord *control2, os_coord *to, + void *user) +{ + printf("Bezier to (%d,%d),(%d,%d),(%d,%d)\n", + control1->x, control1->y, + control2->x, control2->y, + to->x, to->y); + + return 0; +} + + void callback(void *context, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, |