From ed08ea6bba0ad1528b0073e7ef6c4bfa7f6b5154 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 5 Nov 2004 10:57:50 +0000 Subject: Change the signs of a variety of metrics, which were backwards. Return early if we found a rectangular clip at all, not just in error case. Give render glyphset entry the negative bbox offsets it wants, not the bearings. --- src/cairo-ft-font.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index f757db09c..ca1dc2182 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -527,7 +527,7 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font, continue; x += val->extents.x_advance; - y -= val->extents.y_advance; + y += val->extents.y_advance; } _cairo_unlock_global_image_glyph_cache (); @@ -614,7 +614,7 @@ _cairo_ft_font_glyph_extents (void *abstract_font, cairo_ft_font_create_for_ft_face accept an FcPattern. */ glyph_min.x = glyphs[i].x + img->extents.x_bearing; - glyph_min.y = glyphs[i].y - img->extents.y_bearing; + glyph_min.y = glyphs[i].y + img->extents.y_bearing; glyph_max.x = glyph_min.x + img->extents.width; glyph_max.y = glyph_min.y + img->extents.height; @@ -640,7 +640,7 @@ _cairo_ft_font_glyph_extents (void *abstract_font, extents->width = total_max.x - total_min.x; extents->height = total_max.y - total_min.y; extents->x_advance = glyphs[i-1].x + (img == NULL ? 0 : img->extents.x_advance) - origin.x; - extents->y_advance = glyphs[i-1].y + 0 - origin.y; + extents->y_advance = glyphs[i-1].y + (img == NULL ? 0 : img->extents.y_advance) - origin.y; return CAIRO_STATUS_SUCCESS; } @@ -688,7 +688,7 @@ _cairo_ft_font_glyph_bbox (void *abstract_font, continue; x1 = _cairo_fixed_from_double (glyphs[i].x + img->size.x); - y1 = _cairo_fixed_from_double (glyphs[i].y - img->size.y); + y1 = _cairo_fixed_from_double (glyphs[i].y + img->size.y); x2 = x1 + _cairo_fixed_from_double (img->size.width); y2 = y1 + _cairo_fixed_from_double (img->size.height); @@ -763,10 +763,10 @@ _cairo_ft_font_show_glyphs (void *abstract_font, &(img->image->base), surface, source_x + x + img->size.x, - source_y + y - img->size.y, + source_y + y + img->size.y, 0, 0, x + img->size.x, - y - img->size.y, + y + img->size.y, (double) img->size.width, (double) img->size.height); @@ -928,12 +928,19 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) if (FT_Load_Glyph (font->val->face, val->key.index, FT_LOAD_DEFAULT) != 0) return CAIRO_STATUS_NO_MEMORY; + /* + * Note: the font's coordinate system is upside down from ours, so the + * Y coordinates of the bearing and advance need to be negated. + */ + val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX); - val->extents.y_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingY); + val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY); + val->extents.width = DOUBLE_FROM_26_6 (metrics->width); val->extents.height = DOUBLE_FROM_26_6 (metrics->height); + val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->advance.x); - val->extents.y_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->advance.y); + val->extents.y_advance = -DOUBLE_FROM_26_6 (font->val->face->glyph->advance.y); outline = &glyphslot->outline; @@ -982,11 +989,16 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) _cairo_image_surface_assume_ownership_of_data (val->image); } - + + /* + * Note: the font's coordinate system is upside down from ours, so the + * Y coordinate of the control box needs to be negated. + */ + val->size.width = (unsigned short) width; val->size.height = (unsigned short) height; - val->size.x = (short) (cbox.xMin >> 6); - val->size.y = (short) (cbox.yMax >> 6); + val->size.x = (short) (cbox.xMin >> 6); + val->size.y = - (short) (cbox.yMax >> 6); return CAIRO_STATUS_SUCCESS; } -- cgit v1.2.3 From b6a2e10301a6670b9678afcc7fda8c1826dd72c8 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 12 Nov 2004 06:12:20 +0000 Subject: Move declarations above statements to satisfy pre-C99 compilers. Thanks to Michael Johnson . --- ChangeLog | 7 +++++++ src/cairo-font.c | 5 ++--- src/cairo-ft-font.c | 7 +++---- src/cairo_font.c | 5 ++--- src/cairo_ft_font.c | 7 +++---- 5 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index 26e6ca2f0..c7ff0a898 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-11-12 Carl Worth + + * src/cairo_font.c (_font_cache_hash, _font_cache_create_entry): + * src/cairo_ft_font.c (_cairo_ft_font_text_to_glyphs): Move + declarations above statements to satisfy pre-C99 compilers. Thanks + to Michael Johnson . + 2004-11-09 Carl Worth * test/text_rotate.c (NUM_TEXT): Increase size and increase number diff --git a/src/cairo-font.c b/src/cairo-font.c index 5ad9f0417..81ead6a1b 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -54,9 +54,9 @@ typedef struct { static unsigned long _font_cache_hash (void *cache, void *key) { + unsigned long hash; cairo_font_cache_key_t *in; in = (cairo_font_cache_key_t *) key; - unsigned long hash; /* 1607 and 1451 are just a couple random primes. */ hash = _cairo_hash_string (in->family); @@ -86,12 +86,11 @@ _font_cache_create_entry (void *cache, void *key, void **return_value) { + const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; cairo_font_cache_key_t *k; cairo_font_cache_entry_t *entry; k = (cairo_font_cache_key_t *) key; - const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; - /* XXX: The current freetype backend may return NULL, (for example * if no fonts are installed), but I would like to guarantee that * the toy API always returns at least *some* font, so I would diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index ca1dc2182..8a6dcb777 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -481,6 +481,9 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font, cairo_glyph_t **glyphs, int *nglyphs) { + double x = 0., y = 0.; + size_t i; + FT_ULong *ucs4 = NULL; cairo_ft_font_t *font = abstract_font; FT_Face face = font->val->face; cairo_glyph_cache_key_t key; @@ -490,10 +493,6 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font, key.unscaled = &font->base; key.scale = *sc; - double x = 0., y = 0.; - size_t i; - FT_ULong *ucs4 = NULL; - _utf8_to_ucs4 (utf8, &ucs4, nglyphs); if (ucs4 == NULL) diff --git a/src/cairo_font.c b/src/cairo_font.c index 5ad9f0417..81ead6a1b 100644 --- a/src/cairo_font.c +++ b/src/cairo_font.c @@ -54,9 +54,9 @@ typedef struct { static unsigned long _font_cache_hash (void *cache, void *key) { + unsigned long hash; cairo_font_cache_key_t *in; in = (cairo_font_cache_key_t *) key; - unsigned long hash; /* 1607 and 1451 are just a couple random primes. */ hash = _cairo_hash_string (in->family); @@ -86,12 +86,11 @@ _font_cache_create_entry (void *cache, void *key, void **return_value) { + const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; cairo_font_cache_key_t *k; cairo_font_cache_entry_t *entry; k = (cairo_font_cache_key_t *) key; - const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; - /* XXX: The current freetype backend may return NULL, (for example * if no fonts are installed), but I would like to guarantee that * the toy API always returns at least *some* font, so I would diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index ca1dc2182..8a6dcb777 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -481,6 +481,9 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font, cairo_glyph_t **glyphs, int *nglyphs) { + double x = 0., y = 0.; + size_t i; + FT_ULong *ucs4 = NULL; cairo_ft_font_t *font = abstract_font; FT_Face face = font->val->face; cairo_glyph_cache_key_t key; @@ -490,10 +493,6 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font, key.unscaled = &font->base; key.scale = *sc; - double x = 0., y = 0.; - size_t i; - FT_ULong *ucs4 = NULL; - _utf8_to_ucs4 (utf8, &ucs4, nglyphs); if (ucs4 == NULL) -- cgit v1.2.3 From 1a21b8289fcbfb808852d152f13f0ff0da935c9c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 21 Dec 2004 13:14:45 +0000 Subject: With thanks to Kristian Høgsberg : Tag a few private functions/data that were missing __internal_linkage. Mark cache backends as static. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 11 +++++++++++ src/cairo-font.c | 6 ++---- src/cairo-ft-font.c | 3 +-- src/cairo-wideint.h | 20 ++++++++++---------- src/cairo-xlib-surface.c | 2 +- src/cairo_font.c | 6 ++---- src/cairo_ft_font.c | 3 +-- src/cairo_wideint.h | 20 ++++++++++---------- src/cairo_xlib_surface.c | 2 +- src/cairoint.h | 11 +++++------ 10 files changed, 44 insertions(+), 40 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index e58ed43bf..1f13fb88b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-12-21 Carl Worth + + With thanks to Kristian Høgsberg : + * src/cairoint.h: + * src/cairo_wideint.h: Tag a few private functions/data that were + missing __internal_linkage. + + * src/cairo_xlib_surface.c: + * src/cairo_ft_font.c: + * src/cairo_font.c: Mark cache backends as static. + 2004-12-20 Carl Worth * autogen.sh (LANG): Change "head -1" to more standard "head -n diff --git a/src/cairo-font.c b/src/cairo-font.c index 81ead6a1b..406a84ebd 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -144,7 +144,7 @@ _font_cache_destroy_cache (void *cache) free (cache); } -const struct cairo_cache_backend cairo_font_cache_backend = { +static const struct cairo_cache_backend cairo_font_cache_backend = { _font_cache_hash, _font_cache_keys_equal, _font_cache_create_entry, @@ -152,7 +152,6 @@ const struct cairo_cache_backend cairo_font_cache_backend = { _font_cache_destroy_cache }; - static void _lock_global_font_cache (void) { @@ -475,7 +474,7 @@ _image_glyph_cache_destroy_cache (void *cache) free (cache); } -const cairo_cache_backend_t cairo_image_cache_backend = { +static const cairo_cache_backend_t cairo_image_cache_backend = { _cairo_glyph_cache_hash, _cairo_glyph_cache_keys_equal, _image_glyph_cache_create_entry, @@ -483,7 +482,6 @@ const cairo_cache_backend_t cairo_image_cache_backend = { _image_glyph_cache_destroy_cache }; - void _cairo_lock_global_image_glyph_cache() { diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 8a6dcb777..9ac9cff3c 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -246,7 +246,7 @@ _ft_font_cache_destroy_cache (void *cache) free (fc); } -const struct cairo_cache_backend _ft_font_cache_backend = { +static const struct cairo_cache_backend _ft_font_cache_backend = { _ft_font_cache_hash, _ft_font_cache_keys_equal, _ft_font_cache_create_entry, @@ -254,7 +254,6 @@ const struct cairo_cache_backend _ft_font_cache_backend = { _ft_font_cache_destroy_cache }; - static ft_cache_t *_global_ft_cache = NULL; static void diff --git a/src/cairo-wideint.h b/src/cairo-wideint.h index d08e039f1..2a4d32a62 100644 --- a/src/cairo-wideint.h +++ b/src/cairo-wideint.h @@ -1,5 +1,5 @@ /* - * $Id: cairo-wideint.h,v 1.1 2004-05-28 19:37:15 keithp Exp $ + * $Id: cairo-wideint.h,v 1.2 2004-12-21 21:14:46 cworth Exp $ * * Copyright © 2004 Keith Packard * @@ -50,8 +50,8 @@ const cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); const cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); const cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); const cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); -const int _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); -const int _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); const cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); #define _cairo_uint64_negative(a) (((int32_t) ((a).hi)) < 0) const cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); @@ -59,13 +59,13 @@ const cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); #define _cairo_uint64_to_int64(i) (i) #define _cairo_int64_to_uint64(i) (i) -const cairo_int64_t I _cairo_int32_to_int64(int32_t i); +const cairo_int64_t I _cairo_int32_to_int64(int32_t i); #define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) #define _cairo_int32x32_64_mul(a,b) _cairo_uint32x32_64_mul ((uint32_t) (a), (uint32_t) (b))) -const int _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) #define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) #define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) @@ -171,8 +171,8 @@ const cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64 const cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); const cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); const cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); -const int _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); -const int _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); +const int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); +const int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); const cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); #define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) const cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); @@ -180,8 +180,8 @@ const cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); #define _cairo_uint128_to_int128_(i) (i) #define _cairo_int128_to_uint128(i) (i) -const cairo_int128_t I _cairo_int32_to_int128 (int32_t i); -const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); +const cairo_int128_t I _cairo_int32_to_int128 (int32_t i); +const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo); #define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) #define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) @@ -191,7 +191,7 @@ const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) #define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) #define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) -const int _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); +const int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); #define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) #define _cairo_int128_negate(a) _cairo_uint128_negate(a) #define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 92a36b2cb..cb8899bed 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -944,7 +944,7 @@ _xlib_glyphset_cache_destroy_entry (void *cache, void *entry) free (v); } -const cairo_cache_backend_t _xlib_glyphset_cache_backend = { +static const cairo_cache_backend_t _xlib_glyphset_cache_backend = { _cairo_glyph_cache_hash, _cairo_glyph_cache_keys_equal, _xlib_glyphset_cache_create_entry, diff --git a/src/cairo_font.c b/src/cairo_font.c index 81ead6a1b..406a84ebd 100644 --- a/src/cairo_font.c +++ b/src/cairo_font.c @@ -144,7 +144,7 @@ _font_cache_destroy_cache (void *cache) free (cache); } -const struct cairo_cache_backend cairo_font_cache_backend = { +static const struct cairo_cache_backend cairo_font_cache_backend = { _font_cache_hash, _font_cache_keys_equal, _font_cache_create_entry, @@ -152,7 +152,6 @@ const struct cairo_cache_backend cairo_font_cache_backend = { _font_cache_destroy_cache }; - static void _lock_global_font_cache (void) { @@ -475,7 +474,7 @@ _image_glyph_cache_destroy_cache (void *cache) free (cache); } -const cairo_cache_backend_t cairo_image_cache_backend = { +static const cairo_cache_backend_t cairo_image_cache_backend = { _cairo_glyph_cache_hash, _cairo_glyph_cache_keys_equal, _image_glyph_cache_create_entry, @@ -483,7 +482,6 @@ const cairo_cache_backend_t cairo_image_cache_backend = { _image_glyph_cache_destroy_cache }; - void _cairo_lock_global_image_glyph_cache() { diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index 8a6dcb777..9ac9cff3c 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -246,7 +246,7 @@ _ft_font_cache_destroy_cache (void *cache) free (fc); } -const struct cairo_cache_backend _ft_font_cache_backend = { +static const struct cairo_cache_backend _ft_font_cache_backend = { _ft_font_cache_hash, _ft_font_cache_keys_equal, _ft_font_cache_create_entry, @@ -254,7 +254,6 @@ const struct cairo_cache_backend _ft_font_cache_backend = { _ft_font_cache_destroy_cache }; - static ft_cache_t *_global_ft_cache = NULL; static void diff --git a/src/cairo_wideint.h b/src/cairo_wideint.h index c634ce081..a6474299d 100644 --- a/src/cairo_wideint.h +++ b/src/cairo_wideint.h @@ -1,5 +1,5 @@ /* - * $Id: cairo_wideint.h,v 1.1 2004-05-28 19:37:15 keithp Exp $ + * $Id: cairo_wideint.h,v 1.2 2004-12-21 21:14:46 cworth Exp $ * * Copyright © 2004 Keith Packard * @@ -50,8 +50,8 @@ const cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); const cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); const cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); const cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); -const int _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); -const int _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); const cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); #define _cairo_uint64_negative(a) (((int32_t) ((a).hi)) < 0) const cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); @@ -59,13 +59,13 @@ const cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); #define _cairo_uint64_to_int64(i) (i) #define _cairo_int64_to_uint64(i) (i) -const cairo_int64_t I _cairo_int32_to_int64(int32_t i); +const cairo_int64_t I _cairo_int32_to_int64(int32_t i); #define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) #define _cairo_int32x32_64_mul(a,b) _cairo_uint32x32_64_mul ((uint32_t) (a), (uint32_t) (b))) -const int _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); +const int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) #define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) #define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) @@ -171,8 +171,8 @@ const cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64 const cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); const cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); const cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); -const int _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); -const int _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); +const int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); +const int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); const cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); #define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) const cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); @@ -180,8 +180,8 @@ const cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); #define _cairo_uint128_to_int128_(i) (i) #define _cairo_int128_to_uint128(i) (i) -const cairo_int128_t I _cairo_int32_to_int128 (int32_t i); -const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); +const cairo_int128_t I _cairo_int32_to_int128 (int32_t i); +const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo); #define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) #define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) @@ -191,7 +191,7 @@ const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) #define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) #define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) -const int _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); +const int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); #define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) #define _cairo_int128_negate(a) _cairo_uint128_negate(a) #define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) diff --git a/src/cairo_xlib_surface.c b/src/cairo_xlib_surface.c index 92a36b2cb..cb8899bed 100644 --- a/src/cairo_xlib_surface.c +++ b/src/cairo_xlib_surface.c @@ -944,7 +944,7 @@ _xlib_glyphset_cache_destroy_entry (void *cache, void *entry) free (v); } -const cairo_cache_backend_t _xlib_glyphset_cache_backend = { +static const cairo_cache_backend_t _xlib_glyphset_cache_backend = { _cairo_glyph_cache_hash, _cairo_glyph_cache_keys_equal, _xlib_glyphset_cache_create_entry, diff --git a/src/cairoint.h b/src/cairoint.h index a39dd8073..98e6bd027 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -467,8 +467,7 @@ typedef struct cairo_font_backend { } cairo_font_backend_t; /* concrete font backends */ -extern const struct cairo_font_backend cairo_ft_font_backend; - +extern const __internal_linkage struct cairo_font_backend cairo_ft_font_backend; typedef struct cairo_surface_backend { cairo_surface_t * @@ -790,13 +789,13 @@ _cairo_restrict_value (double *value, double min, double max); extern cairo_fixed_t __internal_linkage _cairo_fixed_from_int (int i); -extern cairo_fixed_t +extern cairo_fixed_t __internal_linkage _cairo_fixed_from_double (double d); -cairo_fixed_t +cairo_fixed_t __internal_linkage _cairo_fixed_from_26_6 (uint32_t i); -extern double +extern double __internal_linkage _cairo_fixed_to_double (cairo_fixed_t f); extern int __internal_linkage @@ -1197,7 +1196,7 @@ _cairo_unscaled_font_glyph_path (cairo_unscaled_font_t *font, cairo_path_t *path); /* cairo_hull.c */ -extern cairo_status_t +extern cairo_status_t __internal_linkage _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices); /* cairo_path.c */ -- cgit v1.2.3 From ad2225c6f4f18570cbd5e4391788458533895bb8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Jan 2005 10:03:01 +0000 Subject: Fix math library detection to use autotools helper Remove cache memory usage assertions as single objects can be larger than the cache size Decompose font matrix transformations into a couple of helper routines. Return all metrics in font space. Eliminate compiler warning Expect glyph metrics to be in font space. Compute text extents by fetching one glyph metric at a time, transforming to user space and computing the overall bounding box. use 'sincos' where available. Scale factors now ensure the non-scale transform is area preserving. Scale factors requires another parameter to mark the fixed axis. Change license to LGPL Mark int32x32_64_mul as broken (which it still is) Ensure each glyph is located as close to the specified position as possible interface change to _cairo_matrix_compute_scale_factors --- ChangeLog | 48 ++++++++++++++ cairo.pc.in | 4 +- configure.in | 8 ++- src/Makefile.am | 2 +- src/cairo-cache.c | 6 +- src/cairo-ft-font.c | 126 +++++++++++++++++++++++++++++------ src/cairo-glitz-surface.c | 1 + src/cairo-gstate.c | 164 +++++++++++++++++++++++++++++----------------- src/cairo-hash.c | 6 +- src/cairo-matrix.c | 51 ++++++++++---- src/cairo-wideint.c | 46 ++++++++----- src/cairo-wideint.h | 49 +++++++++----- src/cairo-xlib-surface.c | 33 ++++++---- src/cairo_cache.c | 6 +- src/cairo_ft_font.c | 126 +++++++++++++++++++++++++++++------ src/cairo_glitz_surface.c | 1 + src/cairo_gstate.c | 164 +++++++++++++++++++++++++++++----------------- src/cairo_matrix.c | 51 ++++++++++---- src/cairo_wideint.c | 46 ++++++++----- src/cairo_wideint.h | 49 +++++++++----- src/cairo_xlib_surface.c | 33 ++++++---- src/cairoint.h | 2 +- 22 files changed, 733 insertions(+), 289 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index ae9858507..1352fa0a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,51 @@ +2005-01-11 Keith Packard + + * cairo.pc.in: + * configure.in: + * src/Makefile.am: + Fix math library detection to use autotools helper + + * src/cairo_cache.c: (_cache_sane_state), (_cairo_cache_lookup): + Remove cache memory usage assertions as single objects can + be larger than the cache size + + * src/cairo_ft_font.c: (_cairo_ft_font_compute_transform), + (_cairo_ft_font_install_transform), (_install_font_scale), + (_cairo_ft_font_font_extents), (_cairo_ft_font_glyph_extents), + (_cairo_ft_font_create_glyph): + Decompose font matrix transformations into a couple of + helper routines. + Return all metrics in font space. + + * src/cairo_glitz_surface.c: (_glitz_format): + Eliminate compiler warning + + * src/cairo_gstate.c: (_cairo_gstate_current_font_extents), + (_cairo_gstate_text_to_glyphs), (_cairo_gstate_glyph_extents): + Expect glyph metrics to be in font space. Compute text extents + by fetching one glyph metric at a time, transforming to user + space and computing the overall bounding box. + + * src/cairo_matrix.c: (_cairo_matrix_set_rotate), + (_cairo_matrix_compute_scale_factors): + use 'sincos' where available. + Scale factors now ensure the non-scale transform is area preserving. + Scale factors requires another parameter to mark the fixed axis. + + * src/cairo_wideint.c: + * src/cairo_wideint.h: + Change license to LGPL + Mark int32x32_64_mul as broken (which it still is) + + * src/cairo_xlib_surface.c: (_cairo_xlib_surface_show_glyphs32), + (_cairo_xlib_surface_show_glyphs16), + (_cairo_xlib_surface_show_glyphs8): + Ensure each glyph is located as close to the specified position + as possible + + * src/cairoint.h: + interface change to _cairo_matrix_compute_scale_factors + 2005-01-07 Kristian Høgsberg * configure.in: Add -lz to CAIRO_LIBS when compiling the PDF diff --git a/cairo.pc.in b/cairo.pc.in index 339d576b2..7999eb692 100644 --- a/cairo.pc.in +++ b/cairo.pc.in @@ -8,6 +8,6 @@ Description: Multi-platform 2D graphics library Version: @VERSION@ Requires: fontconfig libpixman @XRENDER_REQUIRES@ @PNG_REQUIRES@ @GLITZ_REQUIRES@ -Libs: -L${libdir} -lcairo -lm -Cflags: -I${includedir} @FREETYPE_CFLAGS@ +Libs: -L${libdir} -lcairo +Cflags: -I${includedir} diff --git a/configure.in b/configure.in index 6cc0c7a4e..33ce007d4 100644 --- a/configure.in +++ b/configure.in @@ -34,6 +34,12 @@ AC_PROG_CPP AM_PROG_LIBTOOL AC_STDC_HEADERS +AC_CHECK_LIBM + +LIBS="$LIBS $LIBM" + +AC_CHECK_FUNCS(sincos) + dnl =========================================================================== AC_ARG_ENABLE(xlib, @@ -268,7 +274,7 @@ if test "x$GCC" = "xyes"; then fi CAIRO_CFLAGS="$CAIRO_CFLAGS $WARN_CFLAGS" -CAIRO_LIBS="$CAIRO_LIBS -lm" +CAIRO_LIBS="$CAIRO_LIBS" AC_SUBST(CAIRO_CFLAGS) AC_SUBST(CAIRO_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index b985e4d28..d0135b81e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -70,4 +70,4 @@ libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS) -libcairo_la_LIBADD = $(CAIRO_LIBS) -lm +libcairo_la_LIBADD = $(CAIRO_LIBS) diff --git a/src/cairo-cache.c b/src/cairo-cache.c index 9e0777844..b097b609b 100644 --- a/src/cairo-cache.c +++ b/src/cairo-cache.c @@ -121,7 +121,8 @@ _cache_sane_state (cairo_cache_t *cache) assert (cache->entries != NULL); assert (cache->backend != NULL); assert (cache->arrangement != NULL); - assert (cache->used_memory <= cache->max_memory); + /* Cannot check this, a single object may larger */ + /* assert (cache->used_memory <= cache->max_memory); */ assert (cache->live_entries <= cache->arrangement->size); } #else @@ -417,7 +418,8 @@ _cairo_cache_lookup (cairo_cache_t *cache, _entry_destroy (cache, idx); } - assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); + /* Can't assert this; new_entry->memory may be larger than max_memory */ + /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ /* Make room in the table for a new slot. */ status = _resize_cache (cache, cache->live_entries + 1); diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 9ac9cff3c..f4c6dfdf2 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -50,6 +50,16 @@ typedef struct { } ft_font_val_t; +/* + * The simple 2x2 matrix is converted into separate scale and shape + * factors so that hinting works right + */ + +typedef struct { + double x_scale, y_scale; + double shape[2][2]; +} ft_font_transform_t; + static ft_font_val_t * _create_from_face (FT_Face face, int owns_face) { @@ -432,11 +442,67 @@ _utf8_to_ucs4 (char const *utf8, *nchars = n; } +/* + * Split a matrix into the component pieces of scale and shape + */ + +static void +_cairo_ft_font_compute_transform (ft_font_transform_t *sf, cairo_font_scale_t *sc) +{ + cairo_matrix_t normalized; + double tx, ty; + + /* The font matrix has x and y "scale" components which we extract and + * use as character scale values. These influence the way freetype + * chooses hints, as well as selecting different bitmaps in + * hand-rendered fonts. We also copy the normalized matrix to + * freetype's transformation. + */ + + cairo_matrix_set_affine (&normalized, + sc->matrix[0][0], + sc->matrix[0][1], + sc->matrix[1][0], + sc->matrix[1][1], + 0, 0); + + _cairo_matrix_compute_scale_factors (&normalized, + &sf->x_scale, &sf->y_scale, + /* XXX */ 1); + cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale); + cairo_matrix_get_affine (&normalized, + &sf->shape[0][0], &sf->shape[0][1], + &sf->shape[1][0], &sf->shape[1][1], + &tx, &ty); +} + +/* + * Set the font transformation + */ + +static void +_cairo_ft_font_install_transform (ft_font_transform_t *sf, FT_Face face) +{ + FT_Matrix mat; + + mat.xx = DOUBLE_TO_16_16(sf->shape[0][0]); + mat.yx = -DOUBLE_TO_16_16(sf->shape[0][1]); + mat.xy = -DOUBLE_TO_16_16(sf->shape[1][0]); + mat.yy = DOUBLE_TO_16_16(sf->shape[1][1]); + + FT_Set_Transform(face, &mat, NULL); + + FT_Set_Char_Size(face, + (FT_F26Dot6) (sf->x_scale * 64.0), + (FT_F26Dot6) (sf->y_scale * 64.0), + 0, 0); +} + static void _install_font_scale (cairo_font_scale_t *sc, FT_Face face) { cairo_matrix_t normalized; - double scale_x, scale_y; + double x_scale, y_scale; double xx, xy, yx, yy, tx, ty; FT_Matrix mat; @@ -454,8 +520,9 @@ _install_font_scale (cairo_font_scale_t *sc, FT_Face face) sc->matrix[1][1], 0, 0); - _cairo_matrix_compute_scale_factors (&normalized, &scale_x, &scale_y); - cairo_matrix_scale (&normalized, 1.0 / scale_x, 1.0 / scale_y); + _cairo_matrix_compute_scale_factors (&normalized, &x_scale, &y_scale, + /* XXX */ 1); + cairo_matrix_scale (&normalized, 1.0 / x_scale, 1.0 / y_scale); cairo_matrix_get_affine (&normalized, &xx /* 00 */ , &yx /* 01 */, &xy /* 10 */, &yy /* 11 */, @@ -469,8 +536,8 @@ _install_font_scale (cairo_font_scale_t *sc, FT_Face face) FT_Set_Transform(face, &mat, NULL); FT_Set_Pixel_Sizes(face, - (FT_UInt) scale_x, - (FT_UInt) scale_y); + (FT_UInt) x_scale, + (FT_UInt) y_scale); } static cairo_status_t @@ -542,13 +609,19 @@ _cairo_ft_font_font_extents (void *abstract_font, cairo_ft_font_t *font = abstract_font; FT_Face face = font->val->face; FT_Size_Metrics *metrics = &face->size->metrics; + ft_font_transform_t sf; - _install_font_scale (sc, face); + _cairo_ft_font_compute_transform (&sf, sc); + _cairo_ft_font_install_transform (&sf, face); - extents->ascent = DOUBLE_FROM_26_6(metrics->ascender); - extents->descent = DOUBLE_FROM_26_6(metrics->descender); - extents->height = DOUBLE_FROM_26_6(metrics->height); - extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance); + /* + * Get to unscaled metrics so that the upper level can get back to + * user space + */ + extents->ascent = DOUBLE_FROM_26_6(metrics->ascender) / sf.y_scale; + extents->descent = DOUBLE_FROM_26_6(metrics->descender) / sf.y_scale; + extents->height = DOUBLE_FROM_26_6(metrics->height) / sf.y_scale; + extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) / sf.x_scale; /* FIXME: this doesn't do vertical layout atm. */ extents->max_y_advance = 0.0; @@ -633,10 +706,10 @@ _cairo_ft_font_glyph_extents (void *abstract_font, } _cairo_unlock_global_image_glyph_cache (); - extents->x_bearing = total_min.x - origin.x; - extents->y_bearing = total_min.y - origin.y; - extents->width = total_max.x - total_min.x; - extents->height = total_max.y - total_min.y; + extents->x_bearing = (total_min.x - origin.x); + extents->y_bearing = (total_min.y - origin.y); + extents->width = (total_max.x - total_min.x); + extents->height = (total_max.y - total_min.y); extents->x_advance = glyphs[i-1].x + (img == NULL ? 0 : img->extents.x_advance) - origin.x; extents->y_advance = glyphs[i-1].y + (img == NULL ? 0 : img->extents.y_advance) - origin.y; @@ -917,11 +990,13 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) FT_BBox cbox; FT_Bitmap bitmap; FT_Glyph_Metrics *metrics; + ft_font_transform_t sf; glyphslot = font->val->face->glyph; metrics = &glyphslot->metrics; - _install_font_scale (&val->key.scale, font->val->face); + _cairo_ft_font_compute_transform (&sf, &val->key.scale); + _cairo_ft_font_install_transform (&sf, font->val->face); if (FT_Load_Glyph (font->val->face, val->key.index, FT_LOAD_DEFAULT) != 0) return CAIRO_STATUS_NO_MEMORY; @@ -929,16 +1004,25 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) /* * Note: the font's coordinate system is upside down from ours, so the * Y coordinates of the bearing and advance need to be negated. + * + * Scale metrics back to glyph space from the scaled glyph space returned + * by FreeType */ - val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX); - val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY); + val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / sf.x_scale; + val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / sf.y_scale; + + val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / sf.x_scale; + val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / sf.y_scale; - val->extents.width = DOUBLE_FROM_26_6 (metrics->width); - val->extents.height = DOUBLE_FROM_26_6 (metrics->height); + /* + * use untransformed advance values + * XXX uses horizontal advance only at present; + should provide FT_LOAD_VERTICAL_LAYOUT + */ - val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->advance.x); - val->extents.y_advance = -DOUBLE_FROM_26_6 (font->val->face->glyph->advance.y); + val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->metrics.horiAdvance) / sf.x_scale; + val->extents.y_advance = 0 / sf.y_scale; outline = &glyphslot->outline; diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index f52531498..16c241247 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -425,6 +425,7 @@ static glitz_format_name_t _glitz_format (cairo_format_t format) { switch (format) { + default: case CAIRO_FORMAT_ARGB32: return GLITZ_STANDARD_ARGB32; case CAIRO_FORMAT_RGB24: diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index d963021da..30bcf57e9 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -2298,30 +2298,27 @@ _cairo_gstate_current_font_extents (cairo_gstate_t *gstate, { cairo_int_status_t status; cairo_font_scale_t sc; - double dummy = 0.0; + double font_scale_x, font_scale_y; _build_font_scale (gstate, &sc); status = _cairo_unscaled_font_font_extents (gstate->font, &sc, extents); - /* The font responded in device space; convert to user space. */ - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->ascent); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->descent); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->height); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->max_x_advance, - &extents->max_y_advance); - + _cairo_matrix_compute_scale_factors (&gstate->font_matrix, + &font_scale_x, &font_scale_y, + /* XXX */ 1); + + /* + * The font responded in unscaled units, scale by the font + * matrix scale factors to get to user space + */ + + extents->ascent *= font_scale_y; + extents->descent *= font_scale_y; + extents->height *= font_scale_y; + extents->max_x_advance *= font_scale_x; + extents->max_y_advance *= font_scale_y; + return status; } @@ -2335,18 +2332,20 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, cairo_font_scale_t sc; cairo_point_t point; - double dev_x, dev_y; + double origin_x, origin_y; int i; _build_font_scale (gstate, &sc); status = _cairo_path_current_point (&gstate->path, &point); if (status == CAIRO_STATUS_NO_CURRENT_POINT) { - dev_x = 0.0; - dev_y = 0.0; + origin_x = 0.0; + origin_y = 0.0; } else { - dev_x = _cairo_fixed_to_double (point.x); - dev_y = _cairo_fixed_to_double (point.y); + origin_x = _cairo_fixed_to_double (point.x); + origin_y = _cairo_fixed_to_double (point.y); + cairo_matrix_transform_point (&gstate->ctm_inverse, + &origin_x, &origin_y); } status = _cairo_unscaled_font_text_to_glyphs (gstate->font, @@ -2355,15 +2354,16 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, if (status || !glyphs || !nglyphs || !(*glyphs) || !(nglyphs)) return status; - /* The font responded in device space, starting from (0,0); add any - current point offset in device space, and convert to user space. */ + /* The font responded in glyph space, starting from (0,0). Convert to + user space by applying the font transform, then add any current point + offset. */ for (i = 0; i < *nglyphs; ++i) { - (*glyphs)[i].x += dev_x; - (*glyphs)[i].y += dev_y; - cairo_matrix_transform_point (&gstate->ctm_inverse, - &((*glyphs)[i].x), - &((*glyphs)[i].y)); + cairo_matrix_transform_point (&gstate->font_matrix, + &((*glyphs)[i].x), + &((*glyphs)[i].y)); + (*glyphs)[i].x += origin_x; + (*glyphs)[i].y += origin_y; } return CAIRO_STATUS_SUCCESS; @@ -2392,44 +2392,88 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate, int num_glyphs, cairo_text_extents_t *extents) { - cairo_status_t status; - cairo_glyph_t *transformed_glyphs; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + cairo_glyph_t origin_glyph; + cairo_text_extents_t origin_extents; cairo_font_scale_t sc; int i; + double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0; + double x_pos = 0.0, y_pos = 0.0; + int set = 0; - _build_font_scale (gstate, &sc); - - transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t)); - if (transformed_glyphs == NULL) - return CAIRO_STATUS_NO_MEMORY; - - for (i = 0; i < num_glyphs; ++i) + if (!num_glyphs) { - transformed_glyphs[i] = glyphs[i]; - cairo_matrix_transform_point (&gstate->ctm, - &transformed_glyphs[i].x, - &transformed_glyphs[i].y); + extents->x_bearing = 0.0; + extents->y_bearing = 0.0; + extents->width = 0.0; + extents->height = 0.0; + extents->x_advance = 0.0; + extents->y_advance = 0.0; + return CAIRO_STATUS_SUCCESS; } - status = _cairo_unscaled_font_glyph_extents (gstate->font, &sc, - transformed_glyphs, num_glyphs, - extents); - - /* The font responded in device space; convert to user space. */ - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->x_bearing, - &extents->y_bearing); + _build_font_scale (gstate, &sc); - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->width, - &extents->height); + for (i = 0; i < num_glyphs; i++) + { + double x, y; + double wm, hm; + + origin_glyph = glyphs[i]; + origin_glyph.x = 0.0; + origin_glyph.y = 0.0; + status = _cairo_unscaled_font_glyph_extents (gstate->font, &sc, + &origin_glyph, 1, + &origin_extents); + + /* + * Transform font space metrics into user space metrics + * by running the corners through the font matrix and + * expanding the bounding box as necessary + */ + x = extents->x_bearing; + y = extents->y_bearing; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + + for (hm = 0.0; hm <= 1.0; hm += 1.0) + for (wm = 0.0; wm <= 1.0; wm += 1.0) + { + x = origin_extents.x_bearing + origin_extents.width * wm; + y = origin_extents.y_bearing + origin_extents.height * hm; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + x += glyphs[i].x; + y += glyphs[i].y; + if (!set) + { + min_x = max_x = x; + min_y = max_y = y; + set = 1; + } + else + { + if (x < min_x) min_x = x; + if (x > max_x) max_x = x; + if (y < min_y) min_y = y; + if (y > max_y) max_y = y; + } + } - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->x_advance, - &extents->y_advance); + x = origin_extents.x_advance; + y = origin_extents.y_advance; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + x_pos = glyphs[i].x + x; + y_pos = glyphs[i].y + y; + } - free (transformed_glyphs); + extents->x_bearing = min_x - glyphs[0].x; + extents->y_bearing = min_y - glyphs[0].y; + extents->width = max_x - min_x; + extents->height = max_y - min_y; + extents->x_advance = x_pos - glyphs[0].x; + extents->y_advance = y_pos - glyphs[0].y; return status; } diff --git a/src/cairo-hash.c b/src/cairo-hash.c index 9e0777844..b097b609b 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -121,7 +121,8 @@ _cache_sane_state (cairo_cache_t *cache) assert (cache->entries != NULL); assert (cache->backend != NULL); assert (cache->arrangement != NULL); - assert (cache->used_memory <= cache->max_memory); + /* Cannot check this, a single object may larger */ + /* assert (cache->used_memory <= cache->max_memory); */ assert (cache->live_entries <= cache->arrangement->size); } #else @@ -417,7 +418,8 @@ _cairo_cache_lookup (cairo_cache_t *cache, _entry_destroy (cache, idx); } - assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); + /* Can't assert this; new_entry->memory may be larger than max_memory */ + /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ /* Make room in the table for a new slot. */ status = _resize_cache (cache, cache->live_entries + 1); diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c index 7fc2694f3..3f5d20a43 100644 --- a/src/cairo-matrix.c +++ b/src/cairo-matrix.c @@ -34,6 +34,7 @@ * Carl D. Worth */ +#define _GNU_SOURCE #include #include @@ -176,9 +177,17 @@ cairo_status_t _cairo_matrix_set_rotate (cairo_matrix_t *matrix, double radians) { + double s; + double c; +#if HAVE_SINCOS + sincos (radians, &s, &c); +#else + s = sin (radians); + c = cos (radians); +#endif return cairo_matrix_set_affine (matrix, - cos (radians), sin (radians), - -sin (radians), cos (radians), + c, s, + -s, c, 0, 0); } @@ -398,19 +407,37 @@ _cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, dou /* Compute the amount that each basis vector is scaled by. */ cairo_status_t -_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy) +_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major) { - double x, y; + double det; - x = 1.0; - y = 0.0; - cairo_matrix_transform_distance (matrix, &x, &y); - *sx = sqrt(x*x + y*y); + _cairo_matrix_compute_determinant (matrix, &det); - x = 0.0; - y = 1.0; - cairo_matrix_transform_distance (matrix, &x, &y); - *sy = sqrt(x*x + y*y); + if (det == 0) + *sx = *sy = 0; + else + { + double x = x_major != 0; + double y = x == 0; + double major, minor; + + cairo_matrix_transform_distance (matrix, &x, &y); + major = sqrt(x*x + y*y); + if (major) + minor = det / major; + else + minor = 0.0; + if (x_major) + { + *sx = major; + *sy = minor; + } + else + { + *sx = minor; + *sy = major; + } + } return CAIRO_STATUS_SUCCESS; } diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c index 67ba3f9b9..601c9edd7 100644 --- a/src/cairo-wideint.c +++ b/src/cairo-wideint.c @@ -1,25 +1,37 @@ /* - * $Id: cairo-wideint.c,v 1.1 2004-05-28 19:37:15 keithp Exp $ + * $Id: cairo-wideint.c,v 1.2 2005-01-11 18:03:01 keithp Exp $ * * Copyright © 2004 Keith Packard * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Keith Packard + * + * Contributor(s): + * Keith R. Packard */ #include "cairoint.h" diff --git a/src/cairo-wideint.h b/src/cairo-wideint.h index caa9a0b4b..7f8ad8b3e 100644 --- a/src/cairo-wideint.h +++ b/src/cairo-wideint.h @@ -1,25 +1,38 @@ /* - * $Id: cairo-wideint.h,v 1.3 2004-12-21 21:22:44 cworth Exp $ + * $Id: cairo-wideint.h,v 1.4 2005-01-11 18:03:01 keithp Exp $ * * Copyright © 2004 Keith Packard * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Keith Packard + * + * Contributor(s): + * Keith R. Packard * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. */ #ifndef CAIRO_WIDEINT_H @@ -64,6 +77,7 @@ const cairo_int64_t I _cairo_int32_to_int64(int32_t i); #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) +/* XXX this is wrong */ #define _cairo_int32x32_64_mul(a,b) _cairo_uint32x32_64_mul ((uint32_t) (a), (uint32_t) (b))) const int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) @@ -187,6 +201,7 @@ const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) #define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) #define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) +/* XXX this is wrong */ #define _cairo_int64x64_128_mul(a,b) _cairo_uint64x64_128_mul ((cairo_uint64_t) (a), (cairo_uint64_t) (b)) #define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) #define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index cb8899bed..d9eaa3f13 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1033,6 +1033,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_unscaled_font_t *font, unsigned int stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1056,10 +1057,12 @@ _cairo_xlib_surface_show_glyphs32 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText32 (self->dpy, @@ -1108,6 +1111,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_unscaled_font_t *font, unsigned short stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1131,10 +1135,12 @@ _cairo_xlib_surface_show_glyphs16 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText16 (self->dpy, @@ -1182,6 +1188,7 @@ _cairo_xlib_surface_show_glyphs8 (cairo_unscaled_font_t *font, char stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1205,10 +1212,12 @@ _cairo_xlib_surface_show_glyphs8 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText8 (self->dpy, diff --git a/src/cairo_cache.c b/src/cairo_cache.c index 9e0777844..b097b609b 100644 --- a/src/cairo_cache.c +++ b/src/cairo_cache.c @@ -121,7 +121,8 @@ _cache_sane_state (cairo_cache_t *cache) assert (cache->entries != NULL); assert (cache->backend != NULL); assert (cache->arrangement != NULL); - assert (cache->used_memory <= cache->max_memory); + /* Cannot check this, a single object may larger */ + /* assert (cache->used_memory <= cache->max_memory); */ assert (cache->live_entries <= cache->arrangement->size); } #else @@ -417,7 +418,8 @@ _cairo_cache_lookup (cairo_cache_t *cache, _entry_destroy (cache, idx); } - assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); + /* Can't assert this; new_entry->memory may be larger than max_memory */ + /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ /* Make room in the table for a new slot. */ status = _resize_cache (cache, cache->live_entries + 1); diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index 9ac9cff3c..f4c6dfdf2 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -50,6 +50,16 @@ typedef struct { } ft_font_val_t; +/* + * The simple 2x2 matrix is converted into separate scale and shape + * factors so that hinting works right + */ + +typedef struct { + double x_scale, y_scale; + double shape[2][2]; +} ft_font_transform_t; + static ft_font_val_t * _create_from_face (FT_Face face, int owns_face) { @@ -432,11 +442,67 @@ _utf8_to_ucs4 (char const *utf8, *nchars = n; } +/* + * Split a matrix into the component pieces of scale and shape + */ + +static void +_cairo_ft_font_compute_transform (ft_font_transform_t *sf, cairo_font_scale_t *sc) +{ + cairo_matrix_t normalized; + double tx, ty; + + /* The font matrix has x and y "scale" components which we extract and + * use as character scale values. These influence the way freetype + * chooses hints, as well as selecting different bitmaps in + * hand-rendered fonts. We also copy the normalized matrix to + * freetype's transformation. + */ + + cairo_matrix_set_affine (&normalized, + sc->matrix[0][0], + sc->matrix[0][1], + sc->matrix[1][0], + sc->matrix[1][1], + 0, 0); + + _cairo_matrix_compute_scale_factors (&normalized, + &sf->x_scale, &sf->y_scale, + /* XXX */ 1); + cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale); + cairo_matrix_get_affine (&normalized, + &sf->shape[0][0], &sf->shape[0][1], + &sf->shape[1][0], &sf->shape[1][1], + &tx, &ty); +} + +/* + * Set the font transformation + */ + +static void +_cairo_ft_font_install_transform (ft_font_transform_t *sf, FT_Face face) +{ + FT_Matrix mat; + + mat.xx = DOUBLE_TO_16_16(sf->shape[0][0]); + mat.yx = -DOUBLE_TO_16_16(sf->shape[0][1]); + mat.xy = -DOUBLE_TO_16_16(sf->shape[1][0]); + mat.yy = DOUBLE_TO_16_16(sf->shape[1][1]); + + FT_Set_Transform(face, &mat, NULL); + + FT_Set_Char_Size(face, + (FT_F26Dot6) (sf->x_scale * 64.0), + (FT_F26Dot6) (sf->y_scale * 64.0), + 0, 0); +} + static void _install_font_scale (cairo_font_scale_t *sc, FT_Face face) { cairo_matrix_t normalized; - double scale_x, scale_y; + double x_scale, y_scale; double xx, xy, yx, yy, tx, ty; FT_Matrix mat; @@ -454,8 +520,9 @@ _install_font_scale (cairo_font_scale_t *sc, FT_Face face) sc->matrix[1][1], 0, 0); - _cairo_matrix_compute_scale_factors (&normalized, &scale_x, &scale_y); - cairo_matrix_scale (&normalized, 1.0 / scale_x, 1.0 / scale_y); + _cairo_matrix_compute_scale_factors (&normalized, &x_scale, &y_scale, + /* XXX */ 1); + cairo_matrix_scale (&normalized, 1.0 / x_scale, 1.0 / y_scale); cairo_matrix_get_affine (&normalized, &xx /* 00 */ , &yx /* 01 */, &xy /* 10 */, &yy /* 11 */, @@ -469,8 +536,8 @@ _install_font_scale (cairo_font_scale_t *sc, FT_Face face) FT_Set_Transform(face, &mat, NULL); FT_Set_Pixel_Sizes(face, - (FT_UInt) scale_x, - (FT_UInt) scale_y); + (FT_UInt) x_scale, + (FT_UInt) y_scale); } static cairo_status_t @@ -542,13 +609,19 @@ _cairo_ft_font_font_extents (void *abstract_font, cairo_ft_font_t *font = abstract_font; FT_Face face = font->val->face; FT_Size_Metrics *metrics = &face->size->metrics; + ft_font_transform_t sf; - _install_font_scale (sc, face); + _cairo_ft_font_compute_transform (&sf, sc); + _cairo_ft_font_install_transform (&sf, face); - extents->ascent = DOUBLE_FROM_26_6(metrics->ascender); - extents->descent = DOUBLE_FROM_26_6(metrics->descender); - extents->height = DOUBLE_FROM_26_6(metrics->height); - extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance); + /* + * Get to unscaled metrics so that the upper level can get back to + * user space + */ + extents->ascent = DOUBLE_FROM_26_6(metrics->ascender) / sf.y_scale; + extents->descent = DOUBLE_FROM_26_6(metrics->descender) / sf.y_scale; + extents->height = DOUBLE_FROM_26_6(metrics->height) / sf.y_scale; + extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) / sf.x_scale; /* FIXME: this doesn't do vertical layout atm. */ extents->max_y_advance = 0.0; @@ -633,10 +706,10 @@ _cairo_ft_font_glyph_extents (void *abstract_font, } _cairo_unlock_global_image_glyph_cache (); - extents->x_bearing = total_min.x - origin.x; - extents->y_bearing = total_min.y - origin.y; - extents->width = total_max.x - total_min.x; - extents->height = total_max.y - total_min.y; + extents->x_bearing = (total_min.x - origin.x); + extents->y_bearing = (total_min.y - origin.y); + extents->width = (total_max.x - total_min.x); + extents->height = (total_max.y - total_min.y); extents->x_advance = glyphs[i-1].x + (img == NULL ? 0 : img->extents.x_advance) - origin.x; extents->y_advance = glyphs[i-1].y + (img == NULL ? 0 : img->extents.y_advance) - origin.y; @@ -917,11 +990,13 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) FT_BBox cbox; FT_Bitmap bitmap; FT_Glyph_Metrics *metrics; + ft_font_transform_t sf; glyphslot = font->val->face->glyph; metrics = &glyphslot->metrics; - _install_font_scale (&val->key.scale, font->val->face); + _cairo_ft_font_compute_transform (&sf, &val->key.scale); + _cairo_ft_font_install_transform (&sf, font->val->face); if (FT_Load_Glyph (font->val->face, val->key.index, FT_LOAD_DEFAULT) != 0) return CAIRO_STATUS_NO_MEMORY; @@ -929,16 +1004,25 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) /* * Note: the font's coordinate system is upside down from ours, so the * Y coordinates of the bearing and advance need to be negated. + * + * Scale metrics back to glyph space from the scaled glyph space returned + * by FreeType */ - val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX); - val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY); + val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / sf.x_scale; + val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / sf.y_scale; + + val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / sf.x_scale; + val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / sf.y_scale; - val->extents.width = DOUBLE_FROM_26_6 (metrics->width); - val->extents.height = DOUBLE_FROM_26_6 (metrics->height); + /* + * use untransformed advance values + * XXX uses horizontal advance only at present; + should provide FT_LOAD_VERTICAL_LAYOUT + */ - val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->advance.x); - val->extents.y_advance = -DOUBLE_FROM_26_6 (font->val->face->glyph->advance.y); + val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->metrics.horiAdvance) / sf.x_scale; + val->extents.y_advance = 0 / sf.y_scale; outline = &glyphslot->outline; diff --git a/src/cairo_glitz_surface.c b/src/cairo_glitz_surface.c index f52531498..16c241247 100644 --- a/src/cairo_glitz_surface.c +++ b/src/cairo_glitz_surface.c @@ -425,6 +425,7 @@ static glitz_format_name_t _glitz_format (cairo_format_t format) { switch (format) { + default: case CAIRO_FORMAT_ARGB32: return GLITZ_STANDARD_ARGB32; case CAIRO_FORMAT_RGB24: diff --git a/src/cairo_gstate.c b/src/cairo_gstate.c index d963021da..30bcf57e9 100644 --- a/src/cairo_gstate.c +++ b/src/cairo_gstate.c @@ -2298,30 +2298,27 @@ _cairo_gstate_current_font_extents (cairo_gstate_t *gstate, { cairo_int_status_t status; cairo_font_scale_t sc; - double dummy = 0.0; + double font_scale_x, font_scale_y; _build_font_scale (gstate, &sc); status = _cairo_unscaled_font_font_extents (gstate->font, &sc, extents); - /* The font responded in device space; convert to user space. */ - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->ascent); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->descent); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &dummy, - &extents->height); - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->max_x_advance, - &extents->max_y_advance); - + _cairo_matrix_compute_scale_factors (&gstate->font_matrix, + &font_scale_x, &font_scale_y, + /* XXX */ 1); + + /* + * The font responded in unscaled units, scale by the font + * matrix scale factors to get to user space + */ + + extents->ascent *= font_scale_y; + extents->descent *= font_scale_y; + extents->height *= font_scale_y; + extents->max_x_advance *= font_scale_x; + extents->max_y_advance *= font_scale_y; + return status; } @@ -2335,18 +2332,20 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, cairo_font_scale_t sc; cairo_point_t point; - double dev_x, dev_y; + double origin_x, origin_y; int i; _build_font_scale (gstate, &sc); status = _cairo_path_current_point (&gstate->path, &point); if (status == CAIRO_STATUS_NO_CURRENT_POINT) { - dev_x = 0.0; - dev_y = 0.0; + origin_x = 0.0; + origin_y = 0.0; } else { - dev_x = _cairo_fixed_to_double (point.x); - dev_y = _cairo_fixed_to_double (point.y); + origin_x = _cairo_fixed_to_double (point.x); + origin_y = _cairo_fixed_to_double (point.y); + cairo_matrix_transform_point (&gstate->ctm_inverse, + &origin_x, &origin_y); } status = _cairo_unscaled_font_text_to_glyphs (gstate->font, @@ -2355,15 +2354,16 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, if (status || !glyphs || !nglyphs || !(*glyphs) || !(nglyphs)) return status; - /* The font responded in device space, starting from (0,0); add any - current point offset in device space, and convert to user space. */ + /* The font responded in glyph space, starting from (0,0). Convert to + user space by applying the font transform, then add any current point + offset. */ for (i = 0; i < *nglyphs; ++i) { - (*glyphs)[i].x += dev_x; - (*glyphs)[i].y += dev_y; - cairo_matrix_transform_point (&gstate->ctm_inverse, - &((*glyphs)[i].x), - &((*glyphs)[i].y)); + cairo_matrix_transform_point (&gstate->font_matrix, + &((*glyphs)[i].x), + &((*glyphs)[i].y)); + (*glyphs)[i].x += origin_x; + (*glyphs)[i].y += origin_y; } return CAIRO_STATUS_SUCCESS; @@ -2392,44 +2392,88 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate, int num_glyphs, cairo_text_extents_t *extents) { - cairo_status_t status; - cairo_glyph_t *transformed_glyphs; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + cairo_glyph_t origin_glyph; + cairo_text_extents_t origin_extents; cairo_font_scale_t sc; int i; + double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0; + double x_pos = 0.0, y_pos = 0.0; + int set = 0; - _build_font_scale (gstate, &sc); - - transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t)); - if (transformed_glyphs == NULL) - return CAIRO_STATUS_NO_MEMORY; - - for (i = 0; i < num_glyphs; ++i) + if (!num_glyphs) { - transformed_glyphs[i] = glyphs[i]; - cairo_matrix_transform_point (&gstate->ctm, - &transformed_glyphs[i].x, - &transformed_glyphs[i].y); + extents->x_bearing = 0.0; + extents->y_bearing = 0.0; + extents->width = 0.0; + extents->height = 0.0; + extents->x_advance = 0.0; + extents->y_advance = 0.0; + return CAIRO_STATUS_SUCCESS; } - status = _cairo_unscaled_font_glyph_extents (gstate->font, &sc, - transformed_glyphs, num_glyphs, - extents); - - /* The font responded in device space; convert to user space. */ - - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->x_bearing, - &extents->y_bearing); + _build_font_scale (gstate, &sc); - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->width, - &extents->height); + for (i = 0; i < num_glyphs; i++) + { + double x, y; + double wm, hm; + + origin_glyph = glyphs[i]; + origin_glyph.x = 0.0; + origin_glyph.y = 0.0; + status = _cairo_unscaled_font_glyph_extents (gstate->font, &sc, + &origin_glyph, 1, + &origin_extents); + + /* + * Transform font space metrics into user space metrics + * by running the corners through the font matrix and + * expanding the bounding box as necessary + */ + x = extents->x_bearing; + y = extents->y_bearing; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + + for (hm = 0.0; hm <= 1.0; hm += 1.0) + for (wm = 0.0; wm <= 1.0; wm += 1.0) + { + x = origin_extents.x_bearing + origin_extents.width * wm; + y = origin_extents.y_bearing + origin_extents.height * hm; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + x += glyphs[i].x; + y += glyphs[i].y; + if (!set) + { + min_x = max_x = x; + min_y = max_y = y; + set = 1; + } + else + { + if (x < min_x) min_x = x; + if (x > max_x) max_x = x; + if (y < min_y) min_y = y; + if (y > max_y) max_y = y; + } + } - cairo_matrix_transform_distance (&gstate->ctm_inverse, - &extents->x_advance, - &extents->y_advance); + x = origin_extents.x_advance; + y = origin_extents.y_advance; + cairo_matrix_transform_point (&gstate->font_matrix, + &x, &y); + x_pos = glyphs[i].x + x; + y_pos = glyphs[i].y + y; + } - free (transformed_glyphs); + extents->x_bearing = min_x - glyphs[0].x; + extents->y_bearing = min_y - glyphs[0].y; + extents->width = max_x - min_x; + extents->height = max_y - min_y; + extents->x_advance = x_pos - glyphs[0].x; + extents->y_advance = y_pos - glyphs[0].y; return status; } diff --git a/src/cairo_matrix.c b/src/cairo_matrix.c index 7fc2694f3..3f5d20a43 100644 --- a/src/cairo_matrix.c +++ b/src/cairo_matrix.c @@ -34,6 +34,7 @@ * Carl D. Worth */ +#define _GNU_SOURCE #include #include @@ -176,9 +177,17 @@ cairo_status_t _cairo_matrix_set_rotate (cairo_matrix_t *matrix, double radians) { + double s; + double c; +#if HAVE_SINCOS + sincos (radians, &s, &c); +#else + s = sin (radians); + c = cos (radians); +#endif return cairo_matrix_set_affine (matrix, - cos (radians), sin (radians), - -sin (radians), cos (radians), + c, s, + -s, c, 0, 0); } @@ -398,19 +407,37 @@ _cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, dou /* Compute the amount that each basis vector is scaled by. */ cairo_status_t -_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy) +_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major) { - double x, y; + double det; - x = 1.0; - y = 0.0; - cairo_matrix_transform_distance (matrix, &x, &y); - *sx = sqrt(x*x + y*y); + _cairo_matrix_compute_determinant (matrix, &det); - x = 0.0; - y = 1.0; - cairo_matrix_transform_distance (matrix, &x, &y); - *sy = sqrt(x*x + y*y); + if (det == 0) + *sx = *sy = 0; + else + { + double x = x_major != 0; + double y = x == 0; + double major, minor; + + cairo_matrix_transform_distance (matrix, &x, &y); + major = sqrt(x*x + y*y); + if (major) + minor = det / major; + else + minor = 0.0; + if (x_major) + { + *sx = major; + *sy = minor; + } + else + { + *sx = minor; + *sy = major; + } + } return CAIRO_STATUS_SUCCESS; } diff --git a/src/cairo_wideint.c b/src/cairo_wideint.c index 45682c1cb..c1e209059 100644 --- a/src/cairo_wideint.c +++ b/src/cairo_wideint.c @@ -1,25 +1,37 @@ /* - * $Id: cairo_wideint.c,v 1.1 2004-05-28 19:37:15 keithp Exp $ + * $Id: cairo_wideint.c,v 1.2 2005-01-11 18:03:01 keithp Exp $ * * Copyright © 2004 Keith Packard * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Keith Packard + * + * Contributor(s): + * Keith R. Packard */ #include "cairoint.h" diff --git a/src/cairo_wideint.h b/src/cairo_wideint.h index d42567084..6196e3b61 100644 --- a/src/cairo_wideint.h +++ b/src/cairo_wideint.h @@ -1,25 +1,38 @@ /* - * $Id: cairo_wideint.h,v 1.3 2004-12-21 21:22:44 cworth Exp $ + * $Id: cairo_wideint.h,v 1.4 2005-01-11 18:03:01 keithp Exp $ * * Copyright © 2004 Keith Packard * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Keith Packard + * + * Contributor(s): + * Keith R. Packard * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. */ #ifndef CAIRO_WIDEINT_H @@ -64,6 +77,7 @@ const cairo_int64_t I _cairo_int32_to_int64(int32_t i); #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) +/* XXX this is wrong */ #define _cairo_int32x32_64_mul(a,b) _cairo_uint32x32_64_mul ((uint32_t) (a), (uint32_t) (b))) const int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) @@ -187,6 +201,7 @@ const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) #define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) #define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) +/* XXX this is wrong */ #define _cairo_int64x64_128_mul(a,b) _cairo_uint64x64_128_mul ((cairo_uint64_t) (a), (cairo_uint64_t) (b)) #define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) #define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) diff --git a/src/cairo_xlib_surface.c b/src/cairo_xlib_surface.c index cb8899bed..d9eaa3f13 100644 --- a/src/cairo_xlib_surface.c +++ b/src/cairo_xlib_surface.c @@ -1033,6 +1033,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_unscaled_font_t *font, unsigned int stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1056,10 +1057,12 @@ _cairo_xlib_surface_show_glyphs32 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText32 (self->dpy, @@ -1108,6 +1111,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_unscaled_font_t *font, unsigned short stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1131,10 +1135,12 @@ _cairo_xlib_surface_show_glyphs16 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText16 (self->dpy, @@ -1182,6 +1188,7 @@ _cairo_xlib_surface_show_glyphs8 (cairo_unscaled_font_t *font, char stack_chars [N_STACK_BUF]; int i; + int thisX, thisY; int lastX = 0, lastY = 0; /* Acquire arrays of suitable sizes. */ @@ -1205,10 +1212,12 @@ _cairo_xlib_surface_show_glyphs8 (cairo_unscaled_font_t *font, elts[i].chars = &(chars[i]); elts[i].nchars = 1; elts[i].glyphset = g->glyphset; - elts[i].xOff = glyphs[i].x - lastX; - elts[i].yOff = glyphs[i].y - lastY; - lastX = glyphs[i].x; - lastY = glyphs[i].y; + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + elts[i].xOff = thisX - lastX; + elts[i].yOff = thisY - lastY; + lastX = thisX; + lastY = thisY; } XRenderCompositeText8 (self->dpy, diff --git a/src/cairoint.h b/src/cairoint.h index 7908a97b8..4d01b60fb 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1518,7 +1518,7 @@ cairo_private cairo_status_t _cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, double *lambda2); cairo_private cairo_status_t -_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy); +_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major); cairo_private int _cairo_matrix_is_integer_translation(cairo_matrix_t *matrix, int *itx, int *ity); -- cgit v1.2.3 From a2af89b04a53e2f2fb4a9d7ea4ff879e80d20cd7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 13 Jan 2005 06:50:23 +0000 Subject: Replace all structure tags to have _ prefix. struct cairo_foo -> struct _cairo_foo Also, prefer cairo_foo_t over struct _cairo_foo in .c files. --- ChangeLog | 11 +++++++ src/cairo-font.c | 9 +++-- src/cairo-ft-font.c | 6 ++-- src/cairo-glitz-surface.c | 4 +-- src/cairo-xlib-surface.c | 4 +-- src/cairo.h | 10 +++--- src/cairo_font.c | 9 +++-- src/cairo_ft_font.c | 6 ++-- src/cairo_glitz_surface.c | 4 +-- src/cairo_xlib_surface.c | 4 +-- src/cairoint.h | 84 +++++++++++++++++++++++------------------------ 11 files changed, 80 insertions(+), 71 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index e15ae140c..d711a8f7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-01-13 Carl Worth + + * src/cairo_xlib_surface.c: + * src/cairo_glitz_surface.c: + * src/cairo_ft_font.c: + * src/cairo_font.c: + * src/cairoint.h: + * src/cairo.h: Replace all structure tags to have _ prefix. + struct cairo_foo -> struct _cairo_foo + Also, prefer cairo_foo_t over struct _cairo_foo in .c files. + 2005-01-12 Carl Worth * test/fill_rule.c: Add big_star_path which shows we still have diff --git a/src/cairo-font.c b/src/cairo-font.c index 406a84ebd..f5fc0e981 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -36,7 +36,6 @@ #include "cairoint.h" - /* First we implement a global font cache for named fonts. */ typedef struct { @@ -86,7 +85,7 @@ _font_cache_create_entry (void *cache, void *key, void **return_value) { - const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; + const cairo_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT; cairo_font_cache_key_t *k; cairo_font_cache_entry_t *entry; k = (cairo_font_cache_key_t *) key; @@ -144,7 +143,7 @@ _font_cache_destroy_cache (void *cache) free (cache); } -static const struct cairo_cache_backend cairo_font_cache_backend = { +static const cairo_cache_backend_t cairo_font_cache_backend = { _font_cache_hash, _font_cache_keys_equal, _font_cache_create_entry, @@ -237,8 +236,8 @@ _cairo_font_init (cairo_font_t *scaled, } cairo_status_t -_cairo_unscaled_font_init (cairo_unscaled_font_t *font, - const struct cairo_font_backend *backend) +_cairo_unscaled_font_init (cairo_unscaled_font_t *font, + const cairo_font_backend_t *backend) { font->refcount = 1; font->backend = backend; diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index f4c6dfdf2..b56b58d9f 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -256,7 +256,7 @@ _ft_font_cache_destroy_cache (void *cache) free (fc); } -static const struct cairo_cache_backend _ft_font_cache_backend = { +static const cairo_cache_backend_t _ft_font_cache_backend = { _ft_font_cache_hash, _ft_font_cache_keys_equal, _ft_font_cache_create_entry, @@ -306,7 +306,7 @@ _get_global_ft_cache (void) /* implement the backend interface */ -const struct cairo_font_backend cairo_ft_font_backend; +const cairo_font_backend_t cairo_ft_font_backend; static cairo_unscaled_font_t * _cairo_ft_font_create (const char *family, @@ -1085,7 +1085,7 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) return CAIRO_STATUS_SUCCESS; } -const struct cairo_font_backend cairo_ft_font_backend = { +const cairo_font_backend_t cairo_ft_font_backend = { _cairo_ft_font_create, _cairo_ft_font_destroy, _cairo_ft_font_font_extents, diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 16c241247..8a71b6896 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -63,7 +63,7 @@ cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface) cairo_surface_destroy (crsurface); } -typedef struct cairo_glitz_surface { +typedef struct _cairo_glitz_surface { cairo_surface_t base; glitz_surface_t *surface; @@ -969,7 +969,7 @@ _cairo_glitz_surface_set_clip_region (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static const struct cairo_surface_backend cairo_glitz_surface_backend = { +static const cairo_surface_backend_t cairo_glitz_surface_backend = { _cairo_glitz_surface_create_similar, _cairo_glitz_surface_destroy, _cairo_glitz_surface_pixels_per_inch, diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index d9eaa3f13..383bf247c 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -61,7 +61,7 @@ cairo_set_target_drawable (cairo_t *cr, cairo_surface_destroy (surface); } -typedef struct cairo_xlib_surface { +typedef struct _cairo_xlib_surface { cairo_surface_t base; Display *dpy; @@ -703,7 +703,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font, const cairo_glyph_t *glyphs, int num_glyphs); -static const struct cairo_surface_backend cairo_xlib_surface_backend = { +static const cairo_surface_backend_t cairo_xlib_surface_backend = { _cairo_xlib_surface_create_similar, _cairo_xlib_surface_destroy, _cairo_xlib_surface_pixels_per_inch, diff --git a/src/cairo.h b/src/cairo.h index 4086fdd56..7c91705cf 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -42,10 +42,10 @@ #include #include -typedef struct cairo cairo_t; -typedef struct cairo_surface cairo_surface_t; -typedef struct cairo_matrix cairo_matrix_t; -typedef struct cairo_pattern cairo_pattern_t; +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +typedef struct _cairo_matrix cairo_matrix_t; +typedef struct _cairo_pattern cairo_pattern_t; #ifdef __cplusplus extern "C" { @@ -407,7 +407,7 @@ cairo_clip (cairo_t *cr); /* Font/Text functions */ -typedef struct cairo_font cairo_font_t; +typedef struct _cairo_font cairo_font_t; typedef struct { unsigned long index; diff --git a/src/cairo_font.c b/src/cairo_font.c index 406a84ebd..f5fc0e981 100644 --- a/src/cairo_font.c +++ b/src/cairo_font.c @@ -36,7 +36,6 @@ #include "cairoint.h" - /* First we implement a global font cache for named fonts. */ typedef struct { @@ -86,7 +85,7 @@ _font_cache_create_entry (void *cache, void *key, void **return_value) { - const struct cairo_font_backend *backend = CAIRO_FONT_BACKEND_DEFAULT; + const cairo_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT; cairo_font_cache_key_t *k; cairo_font_cache_entry_t *entry; k = (cairo_font_cache_key_t *) key; @@ -144,7 +143,7 @@ _font_cache_destroy_cache (void *cache) free (cache); } -static const struct cairo_cache_backend cairo_font_cache_backend = { +static const cairo_cache_backend_t cairo_font_cache_backend = { _font_cache_hash, _font_cache_keys_equal, _font_cache_create_entry, @@ -237,8 +236,8 @@ _cairo_font_init (cairo_font_t *scaled, } cairo_status_t -_cairo_unscaled_font_init (cairo_unscaled_font_t *font, - const struct cairo_font_backend *backend) +_cairo_unscaled_font_init (cairo_unscaled_font_t *font, + const cairo_font_backend_t *backend) { font->refcount = 1; font->backend = backend; diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index f4c6dfdf2..b56b58d9f 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -256,7 +256,7 @@ _ft_font_cache_destroy_cache (void *cache) free (fc); } -static const struct cairo_cache_backend _ft_font_cache_backend = { +static const cairo_cache_backend_t _ft_font_cache_backend = { _ft_font_cache_hash, _ft_font_cache_keys_equal, _ft_font_cache_create_entry, @@ -306,7 +306,7 @@ _get_global_ft_cache (void) /* implement the backend interface */ -const struct cairo_font_backend cairo_ft_font_backend; +const cairo_font_backend_t cairo_ft_font_backend; static cairo_unscaled_font_t * _cairo_ft_font_create (const char *family, @@ -1085,7 +1085,7 @@ _cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t *val) return CAIRO_STATUS_SUCCESS; } -const struct cairo_font_backend cairo_ft_font_backend = { +const cairo_font_backend_t cairo_ft_font_backend = { _cairo_ft_font_create, _cairo_ft_font_destroy, _cairo_ft_font_font_extents, diff --git a/src/cairo_glitz_surface.c b/src/cairo_glitz_surface.c index 16c241247..8a71b6896 100644 --- a/src/cairo_glitz_surface.c +++ b/src/cairo_glitz_surface.c @@ -63,7 +63,7 @@ cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface) cairo_surface_destroy (crsurface); } -typedef struct cairo_glitz_surface { +typedef struct _cairo_glitz_surface { cairo_surface_t base; glitz_surface_t *surface; @@ -969,7 +969,7 @@ _cairo_glitz_surface_set_clip_region (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static const struct cairo_surface_backend cairo_glitz_surface_backend = { +static const cairo_surface_backend_t cairo_glitz_surface_backend = { _cairo_glitz_surface_create_similar, _cairo_glitz_surface_destroy, _cairo_glitz_surface_pixels_per_inch, diff --git a/src/cairo_xlib_surface.c b/src/cairo_xlib_surface.c index d9eaa3f13..383bf247c 100644 --- a/src/cairo_xlib_surface.c +++ b/src/cairo_xlib_surface.c @@ -61,7 +61,7 @@ cairo_set_target_drawable (cairo_t *cr, cairo_surface_destroy (surface); } -typedef struct cairo_xlib_surface { +typedef struct _cairo_xlib_surface { cairo_surface_t base; Display *dpy; @@ -703,7 +703,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font, const cairo_glyph_t *glyphs, int num_glyphs); -static const struct cairo_surface_backend cairo_xlib_surface_backend = { +static const cairo_surface_backend_t cairo_xlib_surface_backend = { _cairo_xlib_surface_create_similar, _cairo_xlib_surface_destroy, _cairo_xlib_surface_pixels_per_inch, diff --git a/src/cairoint.h b/src/cairoint.h index 4d01b60fb..addade8f9 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -122,38 +122,38 @@ typedef cairo_fixed_16_16_t cairo_fixed_t; #define CAIRO_MAXSHORT SHRT_MAX #define CAIRO_MINSHORT SHRT_MIN -typedef struct cairo_point { +typedef struct _cairo_point { cairo_fixed_t x; cairo_fixed_t y; } cairo_point_t; -typedef struct cairo_slope +typedef struct _cairo_slope { cairo_fixed_t dx; cairo_fixed_t dy; } cairo_slope_t, cairo_distance_t; -typedef struct cairo_point_double { +typedef struct _cairo_point_double { double x; double y; } cairo_point_double_t; -typedef struct cairo_distance_double { +typedef struct _cairo_distance_double { double dx; double dy; } cairo_distance_double_t; -typedef struct cairo_line { +typedef struct _cairo_line { cairo_point_t p1; cairo_point_t p2; } cairo_line_t, cairo_box_t; -typedef struct cairo_trapezoid { +typedef struct _cairo_trapezoid { cairo_fixed_t top, bottom; cairo_line_t left, right; } cairo_trapezoid_t; -typedef struct cairo_rectangle_int { +typedef struct _cairo_rectangle_int { short x, y; unsigned short width, height; } cairo_rectangle_t, cairo_glyph_size_t; @@ -180,21 +180,21 @@ typedef enum cairo_direction { #define CAIRO_PATH_BUF_SZ 64 -typedef struct cairo_path_op_buf { +typedef struct _cairo_path_op_buf { int num_ops; cairo_path_op_t op[CAIRO_PATH_BUF_SZ]; - struct cairo_path_op_buf *next, *prev; + struct _cairo_path_op_buf *next, *prev; } cairo_path_op_buf_t; -typedef struct cairo_path_arg_buf { +typedef struct _cairo_path_arg_buf { int num_points; cairo_point_t points[CAIRO_PATH_BUF_SZ]; - struct cairo_path_arg_buf *next, *prev; + struct _cairo_path_arg_buf *next, *prev; } cairo_path_arg_buf_t; -typedef struct cairo_path { +typedef struct _cairo_path { cairo_path_op_buf_t *op_head; cairo_path_op_buf_t *op_tail; @@ -206,14 +206,14 @@ typedef struct cairo_path { int has_current_point; } cairo_path_t; -typedef struct cairo_edge { +typedef struct _cairo_edge { cairo_line_t edge; int clockWise; cairo_fixed_16_16_t current_x; } cairo_edge_t; -typedef struct cairo_polygon { +typedef struct _cairo_polygon { int num_edges; int edges_size; cairo_edge_t *edges; @@ -225,7 +225,7 @@ typedef struct cairo_polygon { int closed; } cairo_polygon_t; -typedef struct cairo_spline { +typedef struct _cairo_spline { cairo_point_t a, b, c, d; cairo_slope_t initial_slope; @@ -243,7 +243,7 @@ typedef struct _cairo_pen_vertex { cairo_slope_t slope_cw; } cairo_pen_vertex_t; -typedef struct cairo_pen { +typedef struct _cairo_pen { double radius; double tolerance; @@ -251,13 +251,13 @@ typedef struct cairo_pen { int num_vertices; } cairo_pen_t; -typedef struct cairo_color cairo_color_t; -typedef struct cairo_image_surface cairo_image_surface_t; +typedef struct _cairo_color cairo_color_t; +typedef struct _cairo_image_surface cairo_image_surface_t; /* cairo_array.c structures and functions */ -typedef struct cairo_array cairo_array_t; -struct cairo_array { +typedef struct _cairo_array cairo_array_t; +struct _cairo_array { int size; int num_elements; int element_size; @@ -290,7 +290,7 @@ _cairo_array_num_elements (cairo_array_t *array); /* cairo_cache.c structures and functions */ -typedef struct cairo_cache_backend { +typedef struct _cairo_cache_backend { unsigned long (*hash) (void *cache, void *key); @@ -387,11 +387,11 @@ typedef struct { double matrix[2][2]; } cairo_font_scale_t; -struct cairo_font_backend; +struct _cairo_font_backend; typedef struct { int refcount; - const struct cairo_font_backend *backend; + const struct _cairo_font_backend *backend; } cairo_unscaled_font_t; /* @@ -399,7 +399,7 @@ typedef struct { * matrix. These are the things the user holds references to. */ -struct cairo_font { +struct _cairo_font { int refcount; cairo_font_scale_t scale; cairo_unscaled_font_t *unscaled; @@ -450,7 +450,7 @@ _cairo_glyph_cache_keys_equal (void *cache, /* the font backend interface */ -typedef struct cairo_font_backend { +typedef struct _cairo_font_backend { cairo_unscaled_font_t *(*create) (const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight); @@ -500,9 +500,9 @@ typedef struct cairo_font_backend { } cairo_font_backend_t; /* concrete font backends */ -extern const cairo_private struct cairo_font_backend cairo_ft_font_backend; +extern const cairo_private struct _cairo_font_backend cairo_ft_font_backend; -typedef struct cairo_surface_backend { +typedef struct _cairo_surface_backend { cairo_surface_t * (*create_similar) (void *surface, cairo_format_t format, @@ -604,11 +604,11 @@ typedef struct cairo_surface_backend { } cairo_surface_backend_t; -struct cairo_matrix { +struct _cairo_matrix { double m[3][2]; }; -typedef struct cairo_format_masks { +typedef struct _cairo_format_masks { int bpp; unsigned long alpha_mask; unsigned long red_mask; @@ -616,7 +616,7 @@ typedef struct cairo_format_masks { unsigned long blue_mask; } cairo_format_masks_t; -struct cairo_surface { +struct _cairo_surface { const cairo_surface_backend_t *backend; unsigned int ref_count; @@ -626,7 +626,7 @@ struct cairo_surface { int repeat; }; -struct cairo_image_surface { +struct _cairo_image_surface { cairo_surface_t base; /* libic-specific fields */ @@ -647,7 +647,7 @@ struct cairo_image_surface { madness). I'm still working on a cleaner API, but in the meantime, at least this does prevent precision loss in color when changing alpha. */ -struct cairo_color { +struct _cairo_color { double red; double green; double blue; @@ -669,7 +669,7 @@ typedef enum { CAIRO_PATTERN_RADIAL } cairo_pattern_type_t; -typedef struct cairo_color_stop { +typedef struct _cairo_color_stop { cairo_fixed_t offset; cairo_fixed_48_16_t scale; int id; @@ -681,7 +681,7 @@ typedef void (*cairo_shader_function_t) (unsigned char *color0, cairo_fixed_t factor, int *pixel); -typedef struct cairo_shader_op { +typedef struct _cairo_shader_op { cairo_color_stop_t *stops; int n_stops; cairo_fixed_t min_offset; @@ -690,7 +690,7 @@ typedef struct cairo_shader_op { cairo_shader_function_t shader_function; } cairo_shader_op_t; -struct cairo_pattern { +struct _cairo_pattern { unsigned int ref_count; cairo_extend_t extend; @@ -726,7 +726,7 @@ struct cairo_pattern { } u; }; -typedef struct cairo_traps { +typedef struct _cairo_traps { cairo_trapezoid_t *traps; int num_traps; int traps_size; @@ -751,7 +751,7 @@ typedef struct cairo_traps { #define CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT 96.0 /* Need a name distinct from the cairo_clip function */ -typedef struct cairo_clip_rec { +typedef struct _cairo_clip_rec { int x; int y; int width; @@ -760,7 +760,7 @@ typedef struct cairo_clip_rec { cairo_surface_t *surface; } cairo_clip_rec_t; -typedef struct cairo_gstate { +typedef struct _cairo_gstate { cairo_operator_t operator; double tolerance; @@ -797,16 +797,16 @@ typedef struct cairo_gstate { cairo_pen_t pen_regular; - struct cairo_gstate *next; + struct _cairo_gstate *next; } cairo_gstate_t; -struct cairo { +struct _cairo { unsigned int ref_count; cairo_gstate_t *gstate; cairo_status_t status; }; -typedef struct cairo_stroke_face { +typedef struct _cairo_stroke_face { cairo_point_t ccw; cairo_point_t point; cairo_point_t cw; @@ -1176,7 +1176,7 @@ _cairo_font_init (cairo_font_t *scaled, cairo_private cairo_status_t _cairo_unscaled_font_init (cairo_unscaled_font_t *font, - const struct cairo_font_backend *backend); + const struct _cairo_font_backend *backend); cairo_private void _cairo_unscaled_font_reference (cairo_unscaled_font_t *font); -- cgit v1.2.3 From 429c1f42b5942ebd8b3170e462418880c7cf5e2e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 19 Jan 2005 11:39:06 +0000 Subject: Fix int* vs. size_t* confusion, (currently in favor of int* but only because that's easier to implement). Thanks to John Ellson . Closes bug #2328. --- ChangeLog | 7 +++++++ src/cairo-ft-font.c | 4 ++-- src/cairo_ft_font.c | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index 5a0c78f05..f69139e69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-01-19 Carl Worth + + * src/cairo_ft_font.c (_utf8_to_ucs4): Fix int* vs. size_t* + confusion, (currently in favor of int* but only because that's + easier to implement). Thanks to John Ellson + . Closes bug #2328. + 2005-01-19 Kristian Høgsberg * src/cairo_pdf_surface.c: Add byteswap macros missing for diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index b56b58d9f..2b1016c51 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -411,10 +411,10 @@ _cairo_ft_font_destroy (void *abstract_font) static void _utf8_to_ucs4 (char const *utf8, FT_ULong **ucs4, - size_t *nchars) + int *nchars) { int len = 0, step = 0; - size_t n = 0, alloc = 0; + int n = 0, alloc = 0; FcChar32 u = 0; if (utf8 == NULL || ucs4 == NULL || nchars == NULL) diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index b56b58d9f..2b1016c51 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -411,10 +411,10 @@ _cairo_ft_font_destroy (void *abstract_font) static void _utf8_to_ucs4 (char const *utf8, FT_ULong **ucs4, - size_t *nchars) + int *nchars) { int len = 0, step = 0; - size_t n = 0, alloc = 0; + int n = 0, alloc = 0; FcChar32 u = 0; if (utf8 == NULL || ucs4 == NULL || nchars == NULL) -- cgit v1.2.3 From b646ecfe08601af5587b0f3e10e0bf2e62e355c6 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 20 Jan 2005 08:28:54 +0000 Subject: Track various renamings. Insert new includes for backend-specific header files. Remove redundant include of cairo-features.h. Rename header-exclusion macro from _CAIRO_H_ to CAIRO_H. Remove platform-specific grubbing for cairo-features.h and pixman.h in odd places. Remove all backend-specific prototypes, (as they are now in their own header files). Remove deprecated Remove printf. Convert to utf-8. Use the proper name for multiple-header exclusion (CAIRO_FEATURES_H). Track rename of FREETYPE_FONT_FEATURE to FT_FONT_FEATURE. Split cairo.h up into cairo.h, cairo-ft.h, cairo-glitz.h, cairo-pdf.h, cairo-png.h, cairo-ps.h, cairo-xcb.h, cairo-xlib.h. Update for rename of cairo_wideint.h to cairo-wideint.h. Rename CAIRO_HAS_FREETYPE_FONT to CAIRO_HAS_FT_FONT, (to match cairo_ft_font functions and cairo-ft.h). Update for public header files now in /cairo. --- ChangeLog | 45 ++++++- cairo.pc.in | 3 +- configure.in | 10 +- src/Makefile.am | 27 +++-- src/cairo-features.h.in | 8 +- src/cairo-ft-font.c | 2 + src/cairo-ft.h | 62 ++++++++++ src/cairo-glitz-surface.c | 1 + src/cairo-glitz.h | 53 +++++++++ src/cairo-pdf-surface.c | 4 + src/cairo-pdf.h | 62 ++++++++++ src/cairo-png.h | 59 ++++++++++ src/cairo-ps-surface.c | 1 + src/cairo-ps.h | 63 ++++++++++ src/cairo-quartz.h | 56 +++++++++ src/cairo-xcb.h | 54 +++++++++ src/cairo-xlib-surface.c | 1 + src/cairo-xlib.h | 71 +++++++++++ src/cairo.c | 2 - src/cairo.h | 197 +------------------------------ src/cairo_ft_font.c | 2 + src/cairo_gdip_font.cpp | 1 - src/cairo_gdip_surface.cpp | 1 - src/cairo_glitz_surface.c | 1 + src/cairo_pdf_surface.c | 4 + src/cairo_png_surface.c | 1 + src/cairo_ps_surface.c | 1 + src/cairo_wideint.h | 285 --------------------------------------------- src/cairo_xlib_surface.c | 1 + src/cairoint.h | 6 +- 30 files changed, 580 insertions(+), 504 deletions(-) create mode 100644 src/cairo-ft.h create mode 100644 src/cairo-glitz.h create mode 100644 src/cairo-pdf.h create mode 100644 src/cairo-png.h create mode 100644 src/cairo-ps.h create mode 100644 src/cairo-quartz.h create mode 100644 src/cairo-xcb.h create mode 100644 src/cairo-xlib.h delete mode 100644 src/cairo_wideint.h (limited to 'src/cairo-ft-font.c') diff --git a/ChangeLog b/ChangeLog index 99eb96d27..8bf26e376 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2005-01-20 Carl Worth + + * src/cairoint.h: Track various renamings. + + * src/cairo_xlib_surface.c: + * src/cairo_ps_surface.c: + * src/cairo_png_surface.c: + * src/cairo_pdf_surface.c: + * src/cairo_glitz_surface.c: + * src/cairo_ft_font.c: Insert new includes for backend-specific + header files. + + * src/cairo_gdip_surface.cpp: + * src/cairo_gdip_font.cpp: Remove redundant include of + cairo-features.h. + + * src/cairo.h (CAIRO_H): Rename header-exclusion macro from + _CAIRO_H_ to CAIRO_H. + Remove platform-specific grubbing for cairo-features.h and + pixman.h in odd places. + + Remove all backend-specific prototypes, (as they are now in their + own header files). + + Remove deprecated + + * src/cairo.c (cairo_sane_state): Remove printf. + + * src/cairo-features.h.in: Convert to utf-8. Use the proper name + for multiple-header exclusion (CAIRO_FEATURES_H). Track rename of + FREETYPE_FONT_FEATURE to FT_FONT_FEATURE. + + * src/Makefile.am (cairoinclude_HEADERS): Split cairo.h up into + cairo.h, cairo-ft.h, cairo-glitz.h, cairo-pdf.h, cairo-png.h, + cairo-ps.h, cairo-xcb.h, cairo-xlib.h. + Update for rename of cairo_wideint.h to cairo-wideint.h. + + * configure.in: Rename CAIRO_HAS_FREETYPE_FONT to + CAIRO_HAS_FT_FONT, (to match cairo_ft_font functions and + cairo-ft.h). + + * cairo.pc.in (Cflags): Update for public header files now in + ${includedir}/cairo. + 2005-01-19 Carl Worth * src/cairo_matrix.c (cairo_matrix_get_affine): @@ -80,7 +124,6 @@ * src/cairo_gstate.c: (_cairo_gstate_glyph_extents): Was using the wrong extents variable. ->>>>>>> 1.305 2005-01-13 David Reveman * src/cairo_xcb_surface.c: Replace struct cairo_surface_backend with diff --git a/cairo.pc.in b/cairo.pc.in index 4457b5d20..4e420b202 100644 --- a/cairo.pc.in +++ b/cairo.pc.in @@ -9,5 +9,4 @@ Version: @VERSION@ Requires: fontconfig libpixman @XRENDER_REQUIRES@ @PNG_REQUIRES@ @GLITZ_REQUIRES@ Libs: @FREETYPE_LIBS@ -L${libdir} -lcairo -Cflags: @FREETYPE_CFLAGS@ -I${includedir} - +Cflags: @FREETYPE_CFLAGS@ -I${includedir}/cairo diff --git a/configure.in b/configure.in index e9fa90fb1..fe1ab19c0 100644 --- a/configure.in +++ b/configure.in @@ -273,13 +273,13 @@ CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS" CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS" if test "x$use_freetype" != "xyes"; then - FREETYPE_FONT_FEATURE=CAIRO_HAS_NO_FREETYPE_FONT - AM_CONDITIONAL(CAIRO_HAS_FREETYPE_FONT, false) + FT_FONT_FEATURE=CAIRO_HAS_NO_FT_FONT + AM_CONDITIONAL(CAIRO_HAS_FT_FONT, false) else - FREETYPE_FONT_FEATURE=CAIRO_HAS_FREETYPE_FONT - AM_CONDITIONAL(CAIRO_HAS_FREETYPE_FONT, true) + FT_FONT_FEATURE=CAIRO_HAS_FT_FONT + AM_CONDITIONAL(CAIRO_HAS_FT_FONT, true) fi -AC_SUBST(FREETYPE_FONT_FEATURE) +AC_SUBST(FT_FONT_FEATURE) dnl =========================================================================== diff --git a/src/Makefile.am b/src/Makefile.am index d0135b81e..e5d99ff9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,28 +1,39 @@ +cairoincludedir = $(includedir)/cairo +cairoinclude_HEADERS = \ + cairo.h \ + cairo-features.h\ + cairo-ft.h \ + cairo-glitz.h \ + cairo-pdf.h \ + cairo-png.h \ + cairo-ps.h \ + cairo-xcb.h \ + cairo-xlib.h + lib_LTLIBRARIES = libcairo.la -include_HEADERS = cairo.h cairo-features.h if CAIRO_HAS_PS_SURFACE -libcairo_ps_sources = cairo_ps_surface.c +libcairo_ps_sources = cairo_ps_surface.c cairo-ps.h endif if CAIRO_HAS_PDF_SURFACE -libcairo_pdf_sources = cairo_pdf_surface.c +libcairo_pdf_sources = cairo_pdf_surface.c cairo-pdf.h endif if CAIRO_HAS_PNG_SURFACE -libcairo_png_sources = cairo_png_surface.c +libcairo_png_sources = cairo_png_surface.c cairo-png.h endif if CAIRO_HAS_XLIB_SURFACE -libcairo_xlib_sources = cairo_xlib_surface.c +libcairo_xlib_sources = cairo_xlib_surface.c cairo-xlib.h endif if CAIRO_HAS_XCB_SURFACE -libcairo_xcb_sources = cairo_xcb_surface.c +libcairo_xcb_sources = cairo_xcb_surface.c cairo-xcb.h endif if CAIRO_HAS_GLITZ_SURFACE -libcairo_glitz_sources = cairo_glitz_surface.c +libcairo_glitz_sources = cairo_glitz_surface.c cairo-glitz.h endif # These names match automake style variable definition conventions so @@ -57,7 +68,7 @@ libcairo_la_SOURCES = \ cairo_traps.c \ cairo_pattern.c \ cairo_wideint.c \ - cairo_wideint.h \ + cairo-wideint.h \ $(libcairo_ps_sources) \ $(libcairo_pdf_sources) \ $(libcairo_png_sources) \ diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in index ec6d4241e..c3d016907 100644 --- a/src/cairo-features.h.in +++ b/src/cairo-features.h.in @@ -1,6 +1,6 @@ /* cairo - a vector graphics library with display and print output * - * Copyright © 2003 University of Southern California + * Copyright © 2003 University of Southern California * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public @@ -34,8 +34,8 @@ * Carl Worth */ -#ifndef _CAIRO_CONFIG_H_ -#define _CAIRO_CONFIG_H_ +#ifndef CAIRO_FEATURES_H +#define CAIRO_FEATURES_H #define @PS_SURFACE_FEATURE@ @@ -49,7 +49,7 @@ #define @GLITZ_SURFACE_FEATURE@ -#define @FREETYPE_FONT_FEATURE@ +#define @FT_FONT_FEATURE@ #define @ATSUI_FONT_FEATURE@ diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 2b1016c51..b928b04fc 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -23,6 +23,8 @@ */ #include "cairoint.h" +#include "cairo-ft.h" + #include #include diff --git a/src/cairo-ft.h b/src/cairo-ft.h new file mode 100644 index 000000000..57d439ab2 --- /dev/null +++ b/src/cairo-ft.h @@ -0,0 +1,62 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_FT_H +#define CAIRO_FT_H +#ifdef CAIRO_HAS_FT_FONT + +/* Fontconfig/Freetype platform-specific font interface */ + +#include +#include +#include FT_FREETYPE_H + +cairo_font_t * +cairo_ft_font_create (FT_Library ft_library, FcPattern *pattern); + +cairo_font_t * +cairo_ft_font_create_for_ft_face (FT_Face face); + +FT_Face +cairo_ft_font_face (cairo_font_t *ft_font); + +FcPattern * +cairo_ft_font_pattern (cairo_font_t *ft_font); + +#endif /* CAIRO_HAS_FT_FONT */ +#endif /* CAIRO_FT_H */ diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 8a71b6896..69fc82f2e 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -25,6 +25,7 @@ */ #include "cairoint.h" +#include "cairo-glitz.h" #define GLITZ_FIXED_TO_FLOAT(f) \ (((glitz_float_t) (f)) / 65536) diff --git a/src/cairo-glitz.h b/src/cairo-glitz.h new file mode 100644 index 000000000..350d10233 --- /dev/null +++ b/src/cairo-glitz.h @@ -0,0 +1,53 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_GLITZ_H +#define CAIRO_GLITZ_H +#ifdef CAIRO_HAS_GLITZ_SURFACE + +#include + +void +cairo_set_target_glitz (cairo_t *cr, + glitz_surface_t *surface); + +cairo_surface_t * +cairo_glitz_surface_create (glitz_surface_t *surface); + +#endif /* CAIRO_HAS_GLITZ_SURFACE */ +#endif /* CAIRO_GLITZ_H */ diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 5be9121b1..23230aa74 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -35,6 +35,10 @@ */ #include "cairoint.h" +#include "cairo-pdf.h" +/* XXX: This seems broken to me. What about users without freetype + * that want to use a cairo PDF surface? */ +#include "cairo-ft.h" #include #include FT_FREETYPE_H diff --git a/src/cairo-pdf.h b/src/cairo-pdf.h new file mode 100644 index 000000000..0f624af31 --- /dev/null +++ b/src/cairo-pdf.h @@ -0,0 +1,62 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_PDF_H +#define CAIRO_PDF_H +#ifdef CAIRO_HAS_PDF_SURFACE + +#include + +void +cairo_set_target_pdf (cairo_t *cr, + FILE *file, + double width_inches, + double height_inches, + double x_pixels_per_inch, + double y_pixels_per_inch); + + +cairo_surface_t * +cairo_pdf_surface_create (FILE *file, + double width_inches, + double height_inches, + double x_pixels_per_inch, + double y_pixels_per_inch); + +#endif /* CAIRO_HAS_PDF_SURFACE */ +#endif /* CAIRO_PDF_H */ diff --git a/src/cairo-png.h b/src/cairo-png.h new file mode 100644 index 000000000..766d6f91f --- /dev/null +++ b/src/cairo-png.h @@ -0,0 +1,59 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_PNG_H +#define CAIRO_PNG_H +#ifdef CAIRO_HAS_PNG_SURFACE + +#include + +void +cairo_set_target_png (cairo_t *cr, + FILE *file, + cairo_format_t format, + int width, + int height); + +cairo_surface_t * +cairo_png_surface_create (FILE *file, + cairo_format_t format, + int width, + int height); + +#endif /* CAIRO_HAS_PNG_SURFACE */ +#endif /* CAIRO_PNG_H */ diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 5851322d2..4da8162c7 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -35,6 +35,7 @@ */ #include "cairoint.h" +#include "cairo-ps.h" #include #include diff --git a/src/cairo-ps.h b/src/cairo-ps.h new file mode 100644 index 000000000..ae8e72192 --- /dev/null +++ b/src/cairo-ps.h @@ -0,0 +1,63 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_PS_H +#define CAIRO_PS_H +#ifdef CAIRO_HAS_PS_SURFACE + +#include + +void +cairo_set_target_ps (cairo_t *cr, + FILE *file, + double width_inches, + double height_inches, + double x_pixels_per_inch, + double y_pixels_per_inch); + +/* PS-surface functions */ + +cairo_surface_t * +cairo_ps_surface_create (FILE *file, + double width_inches, + double height_inches, + double x_pixels_per_inch, + double y_pixels_per_inch); + +#endif /* CAIRO_HAS_PS_SURFACE */ +#endif /* CAIRO_PS_H */ diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h new file mode 100644 index 000000000..572356fda --- /dev/null +++ b/src/cairo-quartz.h @@ -0,0 +1,56 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_QUARTZ_H +#define CAIRO_QUARTZ_H +#ifdef CAIRO_HAS_QUARTZ_SURFACE + +void +cairo_set_target_quartz_context( cairo_t *cr, + CGContextRef context, + int width, + int height); + +cairo_surface_t * +cairo_quartz_surface_create ( CGContextRef context, + int width, + int height); + +#endif /* CAIRO_HAS_QUARTZ_SURFACE */ +#endif /* CAIRO_QUARTZ_H */ + diff --git a/src/cairo-xcb.h b/src/cairo-xcb.h new file mode 100644 index 000000000..27ebad523 --- /dev/null +++ b/src/cairo-xcb.h @@ -0,0 +1,54 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_XCB_H +#define CAIRO_XCB_H +#ifdef CAIRO_HAS_XCB_SURFACE + +#include +#include + +void +cairo_set_target_xcb (cairo_t *cr, + XCBConnection *dpy, + XCBDRAWABLE drawable, + XCBVISUALTYPE *visual, + cairo_format_t format); + +#endif /* CAIRO_HAS_XCB_SURFACE */ +#endif /* CAIRO_XCB_H */ diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 1867d5985..d9d74f583 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -35,6 +35,7 @@ */ #include "cairoint.h" +#include "cairo-xlib.h" void cairo_set_target_drawable (cairo_t *cr, diff --git a/src/cairo-xlib.h b/src/cairo-xlib.h new file mode 100644 index 000000000..4f241b034 --- /dev/null +++ b/src/cairo-xlib.h @@ -0,0 +1,71 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#include + +#ifndef CAIRO_XLIB_H +#define CAIRO_XLIB_H +#ifdef CAIRO_HAS_XLIB_SURFACE + +#include + +/* XXX: This shold be renamed to cairo_set_target_xlib to match the + * other backends */ +void +cairo_set_target_drawable (cairo_t *cr, + Display *dpy, + Drawable drawable); + +/* XXX: This is a mess from the user's POV. Should the Visual or the + cairo_format_t control what render format is used? Maybe I can have + cairo_surface_create_for_window with a visual, and + cairo_surface_create_for_pixmap with a cairo_format_t. Would that work? +*/ +cairo_surface_t * +cairo_xlib_surface_create (Display *dpy, + Drawable drawable, + Visual *visual, + cairo_format_t format, + Colormap colormap); + +/* XXX: This has been proposed +cairo_status_t +cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height); +*/ + +#endif /* CAIRO_HAS_XLIB_SURFACE */ +#endif /* CAIRO_XLIB_H */ + diff --git a/src/cairo.c b/src/cairo.c index 577c41985..20d94938c 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -39,7 +39,6 @@ #define CAIRO_TOLERANCE_MINIMUM 0.0002 /* We're limited by 16 bits of sub-pixel precision */ - #ifdef CAIRO_DO_SANITY_CHECKING #include static int @@ -59,7 +58,6 @@ cairo_sane_state (cairo_t *cr) case CAIRO_STATUS_NULL_POINTER: break; default: - printf ("cairo status is bad: %d\n", cr->status); return 0; } return 1; diff --git a/src/cairo.h b/src/cairo.h index dc7efd093..b7bcc1dbb 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -34,19 +34,11 @@ * Carl D. Worth */ -#ifndef _CAIRO_H_ -#define _CAIRO_H_ - -#if !TARGET_OS_MAC - #include - #include -#else - #include - #include -#endif - +#ifndef CAIRO_H +#define CAIRO_H -#include +#include +#include typedef struct _cairo cairo_t; typedef struct _cairo_surface cairo_surface_t; @@ -104,91 +96,6 @@ cairo_set_target_image (cairo_t *cr, int height, int stride); -#ifdef CAIRO_HAS_PS_SURFACE - -#include - -void -cairo_set_target_ps (cairo_t *cr, - FILE *file, - double width_inches, - double height_inches, - double x_pixels_per_inch, - double y_pixels_per_inch); - -#endif /* CAIRO_HAS_PS_SURFACE */ - -#ifdef CAIRO_HAS_PDF_SURFACE - -#include - -void -cairo_set_target_pdf (cairo_t *cr, - FILE *file, - double width_inches, - double height_inches, - double x_pixels_per_inch, - double y_pixels_per_inch); - -#endif /* CAIRO_HAS_PDF_SURFACE */ - -#ifdef CAIRO_HAS_PNG_SURFACE - -#include - -void -cairo_set_target_png (cairo_t *cr, - FILE *file, - cairo_format_t format, - int width, - int height); - -#endif /* CAIRO_HAS_PNG_SURFACE */ - -#ifdef CAIRO_HAS_XLIB_SURFACE - -#include - -/* XXX: This shold be renamed to cairo_set_target_xlib to match the - * other backends */ -void -cairo_set_target_drawable (cairo_t *cr, - Display *dpy, - Drawable drawable); -#endif /* CAIRO_HAS_XLIB_SURFACE */ - -#ifdef CAIRO_HAS_XCB_SURFACE - -#include -#include - -void -cairo_set_target_xcb (cairo_t *cr, - XCBConnection *dpy, - XCBDRAWABLE drawable, - XCBVISUALTYPE *visual, - cairo_format_t format); -#endif /* CAIRO_HAS_XCB_SURFACE */ - -#ifdef CAIRO_HAS_GLITZ_SURFACE - -#include - -void -cairo_set_target_glitz (cairo_t *cr, - glitz_surface_t *surface); -#endif /* CAIRO_HAS_GLITZ_SURFACE */ - -#ifdef CAIRO_HAS_QUARTZ_SURFACE - -void -cairo_set_target_quartz_context( cairo_t *cr, - CGContextRef context, - int width, - int height); - -#endif /* CAIRO_HAS_QUARTZ_SURFACE */ - typedef enum cairo_operator { CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SRC, @@ -523,27 +430,6 @@ void cairo_font_current_transform (cairo_font_t *font, cairo_matrix_t *matrix); -#ifdef CAIRO_HAS_FREETYPE_FONT -/* Fontconfig/Freetype platform-specific font interface */ - -#include -#include -#include FT_FREETYPE_H - -cairo_font_t * -cairo_ft_font_create (FT_Library ft_library, FcPattern *pattern); - -cairo_font_t * -cairo_ft_font_create_for_ft_face (FT_Face face); - -FT_Face -cairo_ft_font_face (cairo_font_t *ft_font); - -FcPattern * -cairo_ft_font_pattern (cairo_font_t *ft_font); - -#endif /* CAIRO_HAS_FREETYPE_FONT */ - /* Image functions */ /* XXX: Eliminate width/height here */ @@ -768,79 +654,6 @@ cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter); cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t *pattern); -#ifdef CAIRO_HAS_PS_SURFACE - -/* PS-surface functions */ - -cairo_surface_t * -cairo_ps_surface_create (FILE *file, - double width_inches, - double height_inches, - double x_pixels_per_inch, - double y_pixels_per_inch); - -#endif /* CAIRO_HAS_PS_SURFACE */ - -#ifdef CAIRO_HAS_PDF_SURFACE - -cairo_surface_t * -cairo_pdf_surface_create (FILE *file, - double width_inches, - double height_inches, - double x_pixels_per_inch, - double y_pixels_per_inch); - -#endif /* CAIRO_HAS_PDF_SURFACE */ - -#ifdef CAIRO_HAS_PNG_SURFACE - -/* PNG-surface functions */ - -cairo_surface_t * -cairo_png_surface_create (FILE *file, - cairo_format_t format, - int width, - int height); - -#endif /* CAIRO_HAS_PNG_SURFACE */ - -#ifdef CAIRO_HAS_XLIB_SURFACE - -/* XXX: This is a mess from the user's POV. Should the Visual or the - cairo_format_t control what render format is used? Maybe I can have - cairo_surface_create_for_window with a visual, and - cairo_surface_create_for_pixmap with a cairo_format_t. Would that work? -*/ -cairo_surface_t * -cairo_xlib_surface_create (Display *dpy, - Drawable drawable, - Visual *visual, - cairo_format_t format, - Colormap colormap); - -/* XXX: This has been proposed -cairo_status_t -cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height); -*/ - -#endif /* CAIRO_HAS_XLIB_SURFACE */ - -#ifdef CAIRO_HAS_GLITZ_SURFACE - -cairo_surface_t * -cairo_glitz_surface_create (glitz_surface_t *surface); - -#endif /* CAIRO_HAS_GLITZ_SURFACE */ - -#ifdef CAIRO_HAS_QUARTZ_SURFACE - -cairo_surface_t * -cairo_quartz_surface_create ( CGContextRef context, - int width, - int height); - -#endif /* CAIRO_HAS_QUARTZ_SURFACE */ - /* Matrix functions */ /* XXX: Rename all of these to cairo_transform_t */ @@ -915,4 +728,4 @@ cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y); } #endif -#endif +#endif /* CAIRO_H */ diff --git a/src/cairo_ft_font.c b/src/cairo_ft_font.c index 2b1016c51..b928b04fc 100644 --- a/src/cairo_ft_font.c +++ b/src/cairo_ft_font.c @@ -23,6 +23,8 @@ */ #include "cairoint.h" +#include "cairo-ft.h" + #include #include diff --git a/src/cairo_gdip_font.cpp b/src/cairo_gdip_font.cpp index 7414ce5d3..e932e3bac 100644 --- a/src/cairo_gdip_font.cpp +++ b/src/cairo_gdip_font.cpp @@ -34,7 +34,6 @@ */ extern "C" { -#include "cairo-features.h" #include "cairoint.h" } diff --git a/src/cairo_gdip_surface.cpp b/src/cairo_gdip_surface.cpp index d7f98c5df..ec1982b55 100644 --- a/src/cairo_gdip_surface.cpp +++ b/src/cairo_gdip_surface.cpp @@ -34,7 +34,6 @@ */ extern "C" { -#include "cairo-features.h" #include "cairoint.h" } diff --git a/src/cairo_glitz_surface.c b/src/cairo_glitz_surface.c index 8a71b6896..69fc82f2e 100644 --- a/src/cairo_glitz_surface.c +++ b/src/cairo_glitz_surface.c @@ -25,6 +25,7 @@ */ #include "cairoint.h" +#include "cairo-glitz.h" #define GLITZ_FIXED_TO_FLOAT(f) \ (((glitz_float_t) (f)) / 65536) diff --git a/src/cairo_pdf_surface.c b/src/cairo_pdf_surface.c index 5be9121b1..23230aa74 100644 --- a/src/cairo_pdf_surface.c +++ b/src/cairo_pdf_surface.c @@ -35,6 +35,10 @@ */ #include "cairoint.h" +#include "cairo-pdf.h" +/* XXX: This seems broken to me. What about users without freetype + * that want to use a cairo PDF surface? */ +#include "cairo-ft.h" #include #include FT_FREETYPE_H diff --git a/src/cairo_png_surface.c b/src/cairo_png_surface.c index 4c689d599..2279b07a9 100644 --- a/src/cairo_png_surface.c +++ b/src/cairo_png_surface.c @@ -38,6 +38,7 @@ #include #include "cairoint.h" +#include "cairo-png.h" static const cairo_surface_backend_t cairo_png_surface_backend; diff --git a/src/cairo_ps_surface.c b/src/cairo_ps_surface.c index 5851322d2..4da8162c7 100644 --- a/src/cairo_ps_surface.c +++ b/src/cairo_ps_surface.c @@ -35,6 +35,7 @@ */ #include "cairoint.h" +#include "cairo-ps.h" #include #include diff --git a/src/cairo_wideint.h b/src/cairo_wideint.h deleted file mode 100644 index e3c26e315..000000000 --- a/src/cairo_wideint.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * $Id: cairo_wideint.h,v 1.6 2005-01-19 15:11:14 cworth Exp $ - * - * Copyright © 2004 Keith Packard - * - * This library is free software; you can redistribute it and/or - * modify it either under the terms of the GNU Lesser General Public - * License version 2.1 as published by the Free Software Foundation - * (the "LGPL") or, at your option, under the terms of the Mozilla - * Public License Version 1.1 (the "MPL"). If you do not alter this - * notice, a recipient may use your version of this file under either - * the MPL or the LGPL. - * - * You should have received a copy of the LGPL along with this library - * in the file COPYING-LGPL-2.1; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * You should have received a copy of the MPL along with this library - * in the file COPYING-MPL-1.1 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY - * OF ANY KIND, either express or implied. See the LGPL or the MPL for - * the specific language governing rights and limitations. - * - * The Original Code is the cairo graphics library. - * - * The Initial Developer of the Original Code is Keith Packard - * - * Contributor(s): - * Keith R. Packard - * - */ - -#ifndef CAIRO_WIDEINT_H -#define CAIRO_WIDEINT_H - -#include - -/* - * 64-bit datatypes. Two separate implementations, one using - * built-in 64-bit signed/unsigned types another implemented - * as a pair of 32-bit ints - */ - -#define I cairo_private - -#if !HAVE_UINT64_T - -typedef struct _cairo_uint64 { - uint32_t lo, hi; -} cairo_uint64_t, cairo_int64_t; - -cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i); -#define _cairo_uint64_to_uint32(a) ((a).lo) -cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_sub (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); -cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); -cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); -cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); -int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); -int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); -#define _cairo_uint64_negative(a) (((int32_t) ((a).hi)) < 0) -cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); - -#define _cairo_uint64_to_int64(i) (i) -#define _cairo_int64_to_uint64(i) (i) - -cairo_int64_t I _cairo_int32_to_int64(int32_t i); -#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) -#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) -#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) -#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) -int I _cairo_int32x32_64_mul (int32_t a, int32_t b); -int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); -#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) -#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) -#define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) -#define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b) -#define _cairo_int64_negate(a) _cairo_uint64_negate(a) -#define _cairo_int64_negative(a) (((int32_t) ((a).hi)) < 0) -#define _cairo_int64_not(a) _cairo_uint64_not(a) - -#else - -typedef uint64_t cairo_uint64_t; -typedef int64_t cairo_int64_t; - -#define _cairo_uint32_to_uint64(i) ((uint64_t) (i)) -#define _cairo_uint64_to_uint32(i) ((uint32_t) (i)) -#define _cairo_uint64_add(a,b) ((a) + (b)) -#define _cairo_uint64_sub(a,b) ((a) - (b)) -#define _cairo_uint64_mul(a,b) ((a) * (b)) -#define _cairo_uint32x32_64_mul(a,b) ((uint64_t) (a) * (b)) -#define _cairo_uint64_lsl(a,b) ((a) << (b)) -#define _cairo_uint64_rsl(a,b) ((uint64_t) (a) >> (b)) -#define _cairo_uint64_rsa(a,b) ((uint64_t) ((int64_t) (a) >> (b))) -#define _cairo_uint64_lt(a,b) ((a) < (b)) -#define _cairo_uint64_eq(a,b) ((a) == (b)) -#define _cairo_uint64_negate(a) ((uint64_t) -((int64_t) (a))) -#define _cairo_uint64_negative(a) ((int64_t) (a) < 0) -#define _cairo_uint64_not(a) (~(a)) - -#define _cairo_uint64_to_int64(i) ((int64_t) (i)) -#define _cairo_int64_to_uint64(i) ((uint64_t) (i)) - -#define _cairo_int32_to_int64(i) ((int64_t) (i)) -#define _cairo_int64_to_int32(i) ((int32_t) (i)) -#define _cairo_int64_add(a,b) ((a) + (b)) -#define _cairo_int64_sub(a,b) ((a) - (b)) -#define _cairo_int64_mul(a,b) ((a) * (b)) -#define _cairo_int32x32_64_mul(a,b) ((int64_t) (a) * (b)) -#define _cairo_int64_lt(a,b) ((a) < (b)) -#define _cairo_int64_eq(a,b) ((a) == (b)) -#define _cairo_int64_lsl(a,b) ((a) << (b)) -#define _cairo_int64_rsl(a,b) ((int64_t) ((uint64_t) (a) >> (b))) -#define _cairo_int64_rsa(a,b) ((int64_t) (a) >> (b)) -#define _cairo_int64_negate(a) (-(a)) -#define _cairo_int64_negative(a) ((a) < 0) -#define _cairo_int64_not(a) (~(a)) - -#endif - -/* - * 64-bit comparisions derived from lt or eq - */ -#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt(a,b)) -#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq(a,b)) -#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt(a,b)) -#define _cairo_uint64_gt(a,b) _cairo_uint64_lt(b,a) - -#define _cairo_int64_le(a,b) (!_cairo_int64_gt(a,b)) -#define _cairo_int64_ne(a,b) (!_cairo_int64_eq(a,b)) -#define _cairo_int64_ge(a,b) (!_cairo_int64_lt(a,b)) -#define _cairo_int64_gt(a,b) _cairo_int64_lt(b,a) - -/* - * As the C implementation always computes both, create - * a function which returns both for the 'native' type as well - */ - -typedef struct _cairo_uquorem64 { - cairo_uint64_t quo; - cairo_uint64_t rem; -} cairo_uquorem64_t; - -typedef struct _cairo_quorem64 { - cairo_int64_t quo; - cairo_int64_t rem; -} cairo_quorem64_t; - -cairo_uquorem64_t I -_cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den); - -cairo_quorem64_t I -_cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den); - -/* - * 128-bit datatypes. Again, provide two implementations in - * case the machine has a native 128-bit datatype. GCC supports int128_t - * on ia64 - */ - -#if !HAVE_UINT128_T - -typedef struct cairo_uint128 { - cairo_uint64_t lo, hi; -} cairo_uint128_t, cairo_int128_t; - -cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i); -cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i); -#define _cairo_uint128_to_uint64(a) ((a).lo) -#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32(_cairo_uint128_to_uint64(a)) -cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); -cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); -cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); -int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); -int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); -#define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) -cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); - -#define _cairo_uint128_to_int128_(i) (i) -#define _cairo_int128_to_uint128(i) (i) - -cairo_int128_t I _cairo_int32_to_int128 (int32_t i); -cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); -#define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo) -#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) -#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) -#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) -#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) -cairo_uint128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); -#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) -#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) -#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) -int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); -#define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) -#define _cairo_int128_negate(a) _cairo_uint128_negate(a) -#define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) -#define _cairo_int128_not(a) _cairo_uint128_not(a) - -#else /* !HAVE_UINT128_T */ - -typedef uint128_t cairo_uint128_t; -typedef int128_t cairo_int128_t; - -#define _cairo_uint32_to_uint128(i) ((uint128_t) (i)) -#define _cairo_uint64_to_uint128(i) ((uint128_t) (i)) -#define _cairo_uint128_to_uint64(i) ((uint64_t) (i)) -#define _cairo_uint128_to_uint32(i) ((uint32_t) (i)) -#define _cairo_uint128_add(a,b) ((a) + (b)) -#define _cairo_uint128_sub(a,b) ((a) - (b)) -#define _cairo_uint128_mul(a,b) ((a) * (b)) -#define _cairo_uint64x64_128_mul(a,b) ((uint128_t) (a) * (b)) -#define _cairo_uint128_lsl(a,b) ((a) << (b)) -#define _cairo_uint128_rsl(a,b) ((uint128_t) (a) >> (b)) -#define _cairo_uint128_rsa(a,b) ((uint128_t) ((int128_t) (a) >> (b))) -#define _cairo_uint128_lt(a,b) ((a) < (b)) -#define _cairo_uint128_eq(a,b) ((a) == (b)) -#define _cairo_uint128_negate(a) ((uint128_t) -((int128_t) (a))) -#define _cairo_uint128_negative(a) ((int128_t) (a) < 0) -#define _cairo_uint128_not(a) (~(a)) - -#define _cairo_uint128_to_int128(i) ((int128_t) (i)) -#define _cairo_int128_to_uint128(i) ((uint128_t) (i)) - -#define _cairo_int32_to_int128(i) ((int128_t) (i)) -#define _cairo_int64_to_int128(i) ((int128_t) (i)) -#define _cairo_int128_to_int64(i) ((int64_t) (i)) -#define _cairo_int128_to_int32(i) ((int32_t) (i)) -#define _cairo_int128_add(a,b) ((a) + (b)) -#define _cairo_int128_sub(a,b) ((a) - (b)) -#define _cairo_int128_mul(a,b) ((a) * (b)) -#define _cairo_int64x64_128_mul(a,b) ((int128_t) (a) * (b)) -#define _cairo_int128_lt(a,b) ((a) < (b)) -#define _cairo_int128_eq(a,b) ((a) == (b)) -#define _cairo_int128_lsl(a,b) ((a) << (b)) -#define _cairo_int128_rsl(a,b) ((int128_t) ((uint128_t) (a) >> (b))) -#define _cairo_int128_rsa(a,b) ((int128_t) (a) >> (b)) -#define _cairo_int128_negate(a) (-(a)) -#define _cairo_int128_negative(a) ((a) < 0) -#define _cairo_int128_not(a) (~(a)) - -#endif /* HAVE_UINT128_T */ - -typedef struct _cairo_uquorem128 { - cairo_uint128_t quo; - cairo_uint128_t rem; -} cairo_uquorem128_t; - -typedef struct _cairo_quorem128 { - cairo_int128_t quo; - cairo_int128_t rem; -} cairo_quorem128_t; - -cairo_uquorem128_t I -_cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den); - -cairo_quorem128_t I -_cairo_int128_divrem (cairo_int128_t num, cairo_int128_t den); - -#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt(a,b)) -#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq(a,b)) -#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt(a,b)) -#define _cairo_uint128_gt(a,b) _cairo_uint128_lt(b,a) - -#define _cairo_int128_le(a,b) (!_cairo_int128_gt(a,b)) -#define _cairo_int128_ne(a,b) (!_cairo_int128_eq(a,b)) -#define _cairo_int128_ge(a,b) (!_cairo_int128_lt(a,b)) -#define _cairo_int128_gt(a,b) _cairo_int128_lt(b,a) - -#undef I - -#endif /* CAIRO_WIDEINT_H */ diff --git a/src/cairo_xlib_surface.c b/src/cairo_xlib_surface.c index 1867d5985..d9d74f583 100644 --- a/src/cairo_xlib_surface.c +++ b/src/cairo_xlib_surface.c @@ -35,6 +35,7 @@ */ #include "cairoint.h" +#include "cairo-xlib.h" void cairo_set_target_drawable (cairo_t *cr, diff --git a/src/cairoint.h b/src/cairoint.h index d10ed9523..6f9d50617 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -108,7 +108,7 @@ #define __attribute__(x) #endif -#include "cairo_wideint.h" +#include "cairo-wideint.h" typedef int32_t cairo_fixed_16_16_t; typedef cairo_int64_t cairo_fixed_32_32_t; @@ -501,7 +501,7 @@ typedef struct _cairo_font_backend { } cairo_font_backend_t; /* concrete font backends */ -#ifdef CAIRO_HAS_FREETYPE_FONT +#ifdef CAIRO_HAS_FT_FONT extern const cairo_private struct _cairo_font_backend cairo_ft_font_backend; @@ -746,7 +746,7 @@ typedef struct _cairo_traps { #define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL #define CAIRO_FONT_WEIGHT_DEFAULT CAIRO_FONT_WEIGHT_NORMAL -#ifdef CAIRO_HAS_FREETYPE_FONT +#ifdef CAIRO_HAS_FT_FONT #define CAIRO_FONT_FAMILY_DEFAULT "serif" -- cgit v1.2.3