From 5a3c30eafe0b77f69434e139a2e247c8eb4230d7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 24 Feb 2006 15:32:26 -0800 Subject: [PATCH] Implement cairo_font_face_get_type. Add font type to font_face_backend. Also export new CAIRO_FONT_TYPE_TOY. --- src/cairo-atsui-font.c | 1 + src/cairo-font.c | 7 +++++++ src/cairo-ft-font.c | 1 + src/cairo-win32-font.c | 1 + src/cairo.h | 1 + src/cairoint.h | 3 +++ 6 files changed, 14 insertions(+) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 9f3b54da1..572359f8d 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -94,6 +94,7 @@ _cairo_atsui_font_face_scaled_font_create (void *abstract_face, } static const cairo_font_face_backend_t _cairo_atsui_font_face_backend = { + CAIRO_FONT_TYPE_ATSUI, _cairo_atsui_font_face_destroy, _cairo_atsui_font_face_scaled_font_create }; diff --git a/src/cairo-font.c b/src/cairo-font.c index b0fab1b4a..bb184c48d 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -130,6 +130,12 @@ cairo_font_face_destroy (cairo_font_face_t *font_face) free (font_face); } +cairo_font_type_t +cairo_font_face_get_type (cairo_font_face_t *font_face) +{ + return font_face->backend->type; +} + /** * cairo_font_face_status: * @font_face: a #cairo_font_face_t @@ -409,6 +415,7 @@ _cairo_toy_font_face_scaled_font_create (void *abstract_font_face } static const cairo_font_face_backend_t _cairo_toy_font_face_backend = { + CAIRO_FONT_TYPE_TOY, _cairo_toy_font_face_destroy, _cairo_toy_font_face_scaled_font_create }; diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 45997444d..e159826a0 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -2004,6 +2004,7 @@ _cairo_ft_font_face_scaled_font_create (void *abstract_face, } static const cairo_font_face_backend_t _cairo_ft_font_face_backend = { + CAIRO_FONT_TYPE_FT, _cairo_ft_font_face_destroy, _cairo_ft_font_face_scaled_font_create }; diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c index 3343abfd4..ca8e4a610 100644 --- a/src/cairo-win32-font.c +++ b/src/cairo-win32-font.c @@ -1398,6 +1398,7 @@ _cairo_win32_font_face_scaled_font_create (void *abstract_face, } static const cairo_font_face_backend_t _cairo_win32_font_face_backend = { + CAIRO_FONT_TYPE_WIN32, _cairo_win32_font_face_destroy, _cairo_win32_font_face_scaled_font_create }; diff --git a/src/cairo.h b/src/cairo.h index f6187210b..5b38d18e4 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -928,6 +928,7 @@ cairo_font_face_status (cairo_font_face_t *font_face); * of the wrong type is undefined. */ typedef enum _cairo_font_type { + CAIRO_FONT_TYPE_TOY, CAIRO_FONT_TYPE_FT, CAIRO_FONT_TYPE_WIN32, CAIRO_FONT_TYPE_ATSUI diff --git a/src/cairoint.h b/src/cairoint.h index ebf2b31d0..401114cb7 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -464,6 +464,7 @@ struct _cairo_scaled_font { }; struct _cairo_font_face { + /* hash_entry must be first */ cairo_hash_entry_t hash_entry; cairo_status_t status; int ref_count; @@ -555,6 +556,8 @@ struct _cairo_scaled_font_backend { }; struct _cairo_font_face_backend { + cairo_font_type_t type; + /* The destroy() function is allowed to resurrect the font face * by re-referencing. This is needed for the FreeType backend. */