~ubuntu-branches/ubuntu/maverick/cairo/maverick

« back to all changes in this revision

Viewing changes to test/user-font-proxy.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-06-26 16:13:32 UTC
  • mfrom: (1.3.3 upstream) (1.5.10 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626161332-s14u9kutazlea7c1
Tags: 1.9.10-1
* New upstream development release:
  + Use subpixel rendering settings for fonts (Closes: #555722).
  + debian/patches/99_autoreconf.patch:
    - Regenerated for the new version.
  + debian/patches/01_no-private-symbol-export.patch,
    debian/patches/03_no-cxx.patch,
    debian/patches/05_am-maintainer-mode.patch,
    debian/patches/99_ltmain_as-needed.patch:
    - Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#define BORDER 10
36
36
#define TEXT_SIZE 64
37
37
#define WIDTH  (TEXT_SIZE * 12 + 2*BORDER)
38
 
#define HEIGHT ((TEXT_SIZE + 2*BORDER)*2)
39
 
#define TEXT   "geez... cairo user-font"
40
 
 
41
 
static cairo_test_draw_function_t draw;
42
 
 
43
 
static const cairo_test_t test = {
44
 
    "user-font-proxy",
45
 
    "Tests a user-font using a native font in its render_glyph",
46
38
#ifndef ROTATED
47
 
    WIDTH, HEIGHT,
 
39
 #define HEIGHT ((TEXT_SIZE + 2*BORDER)*2)
48
40
#else
49
 
    WIDTH, WIDTH,
 
41
 #define HEIGHT WIDTH
50
42
#endif
51
 
    draw
52
 
};
 
43
#define TEXT   "geez... cairo user-font"
53
44
 
54
45
static cairo_user_data_key_t fallback_font_key;
55
46
 
58
49
                       cairo_t              *cr,
59
50
                       cairo_font_extents_t *extents)
60
51
{
 
52
    cairo_status_t status;
 
53
 
61
54
    cairo_set_font_face (cr,
62
55
                         cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font),
63
56
                                                        &fallback_font_key));
64
57
 
65
 
    cairo_scaled_font_set_user_data (scaled_font,
66
 
                                     &fallback_font_key,
67
 
                                     cairo_scaled_font_reference (cairo_get_scaled_font (cr)),
68
 
                                     (cairo_destroy_func_t) cairo_scaled_font_destroy);
 
58
    status = cairo_scaled_font_set_user_data (scaled_font,
 
59
                                              &fallback_font_key,
 
60
                                              cairo_scaled_font_reference (cairo_get_scaled_font (cr)),
 
61
                                              (cairo_destroy_func_t) cairo_scaled_font_destroy);
 
62
    if (unlikely (status)) {
 
63
        cairo_scaled_font_destroy (cairo_get_scaled_font (cr));
 
64
        return status;
 
65
    }
69
66
 
70
67
    cairo_font_extents (cr, extents);
71
68
 
217
214
    return CAIRO_TEST_SUCCESS;
218
215
}
219
216
 
220
 
int
221
 
main (void)
222
 
{
223
 
    return cairo_test (&test);
224
 
}
 
217
CAIRO_TEST (user_font_proxy,
 
218
            "Tests a user-font using a native font in its render_glyph",
 
219
            "font, user-font", /* keywords */
 
220
            "cairo >= 1.7.4", /* requirements */
 
221
            WIDTH, HEIGHT,
 
222
            NULL, draw)