[cairo-commit] cairo/src cairo-font.c, 1.40, 1.41 cairo-ft-font.c,
1.53, 1.54 cairo-ft-private.h, 1.1, 1.2 cairo-ft.h, 1.2,
1.3 cairo-gstate-private.h, 1.3, 1.4 cairo-gstate.c, 1.103,
1.104 cairo-pdf-surface.c, 1.25, 1.26 cairo-surface.c, 1.52,
1.53 cairo-win32-font.c, 1.12, 1.13 cairo-win32-surface.c,
1.14, 1.15 cairo-win32.h, 1.6, 1.7 cairo-xlib-surface.c, 1.56,
1.57 cairo.c, 1.72, 1.73 cairo.h, 1.92, 1.93 cairoint.h, 1.118,
1.119
Owen Taylor
commit at pdx.freedesktop.org
Thu Apr 7 11:04:02 PDT 2005
- Previous message: [cairo-commit] cairo/doc/public/tmpl cairo-font.sgml, NONE,
1.1 cairo-ft.sgml, 1.2, 1.3 cairo-matrix.sgml, 1.3,
1.4 cairo-pdf.sgml, 1.3, 1.4 cairo-png.sgml, 1.2,
1.3 cairo-surface.sgml, 1.5, 1.6 cairo.sgml, 1.5, 1.6
- Next message: [cairo-commit] cairo ChangeLog,1.475,1.476
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: otaylor
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv7423/src
Modified Files:
cairo-font.c cairo-ft-font.c cairo-ft-private.h cairo-ft.h
cairo-gstate-private.h cairo-gstate.c cairo-pdf-surface.c
cairo-surface.c cairo-win32-font.c cairo-win32-surface.c
cairo-win32.h cairo-xlib-surface.c cairo.c cairo.h cairoint.h
Log Message:
2005-04-06 Owen Taylor <otaylor at redhat.com>
* src/cairo.h src/cairo-gstate.c src/cairo-font.c: Add
a cairo_font_face_t type to hold a description of a font
face. Replace cairo_set_font() with cairo_set_font_face().
* src/cairoint.h src/cairo-font.c src/cairo-gstate.c: Add
"cairo_simple_font_face" for family/weight/slant and use
it to implement font naming for the toy API.
* src/cairo-ft.h src/cairo-ft-font.c cairo-win32.h
cairo-win32-font.c: Switch the FreeType and Win32 backends
over to using cairo_font_face_t.
* src/cairo.h src/cairo-font.c src/cairo-ft-font.c
src/cairo-win32-font.c: Pass in font matrix and CTM separately
rather than as a composite scale when creating fonts; allows
removing font_matrix argument to metrics functions.
* src/cairoint.h src/cairo-font.c src/cairo-ft-font.c
src/cairo-win32-font.c: Remove cairo_font_scale_t type,
just use cairo_matrix_t and ignore translations.
* src/cairo-ft.h src/cairo-ft-font.c: Remove
cairo_ft_font_get_pattern() -- it can't work for all FreeType
backend fonts and doesn't seem particularly useful.
* src/cairo.[ch]: Rename cairo_font_get_extents() to
cairo_font_extents()
* doc/public/cairo-sections.txt: Update, split font functions
into a separate section.
* src/cairo-ft-font.c (_ft_unscaled_font_get_for_pattern): Fix
locking order problem.
* src/cairo-font.c: Add caches for simple font faces and from
cairo_font_face_t to cairo_scaled_font_t.
* src/cairo.h src/cairoint.h src/cairo-font.c src/cairo-win32-font.c
src/cairo-ft-font.c src/cairo-gstate.c src/cairo-gstate-private.h:
Rename cairo_font_t to cairo_scaled_font_t.
Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cairo-font.c 6 Apr 2005 20:01:13 -0000 1.40
+++ cairo-font.c 7 Apr 2005 18:04:00 -0000 1.41
@@ -39,83 +39,705 @@
#include "cairoint.h"
-/* Now the internal "unscaled + scale" font API */
+/* cairo_font_face_t */
-cairo_private cairo_status_t
-_cairo_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
[...1004 lines suppressed...]
- && (a->scale.matrix[0][1] == b->scale.matrix[0][1])
- && (a->scale.matrix[1][0] == b->scale.matrix[1][0])
- && (a->scale.matrix[1][1] == b->scale.matrix[1][1]);
+ && (a->scale.xx == b->scale.xx)
+ && (a->scale.yx == b->scale.yx)
+ && (a->scale.xy == b->scale.xy)
+ && (a->scale.yy == b->scale.yy);
}
@@ -387,7 +1043,8 @@
return CAIRO_STATUS_NO_MEMORY;
im->key = *k;
- status = im->key.unscaled->backend->create_glyph (im);
+ status = im->key.unscaled->backend->create_glyph (im->key.unscaled,
+ im);
if (status != CAIRO_STATUS_SUCCESS) {
free (im);
Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- cairo-ft-font.c 7 Apr 2005 17:01:49 -0000 1.53
+++ cairo-ft-font.c 7 Apr 2005 18:04:00 -0000 1.54
@@ -66,31 +66,42 @@
/*
* We create an object that corresponds to a single font on the disk;
* (identified by a filename/id pair) these are shared between all
- * fonts using that file. For cairo_ft_font_create_for_ft_face(), we
+ * fonts using that file. For cairo_ft_scaled_font_create_for_ft_face(), we
* just create a one-off version with a permanent face value.
*/
+
+typedef struct _ft_font_face ft_font_face_t;
+
[...1220 lines suppressed...]
- return font->pattern;
+ _ft_unscaled_font_unlock_face (scaled_font->unscaled);
}
/* We expose our unscaled font implementation internally for the the
@@ -1516,11 +1533,11 @@
* fonts-on-disk used by a document, so it can embed them.
*/
cairo_unscaled_font_t *
-_cairo_ft_font_get_unscaled_font (cairo_font_t *abstract_font)
+_cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *abstract_font)
{
- cairo_ft_font_t *font = (cairo_ft_font_t *) abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = (cairo_ft_scaled_font_t *) abstract_font;
- return (cairo_unscaled_font_t *)font->unscaled;
+ return &scaled_font->unscaled->base;
}
/* This differs from _cairo_ft_scaled_font_lock_face in that it doesn't
Index: cairo-ft-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-private.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-ft-private.h 21 Jan 2005 22:33:48 -0000 1.1
+++ cairo-ft-private.h 7 Apr 2005 18:04:00 -0000 1.2
@@ -48,7 +48,7 @@
* the different fonts-on-disk used by a document, so it can embed them
*/
cairo_private cairo_unscaled_font_t *
-_cairo_ft_font_get_unscaled_font (cairo_font_t *font);
+_cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *scaled_font);
cairo_private FT_Face
_cairo_ft_unscaled_font_lock_face (cairo_unscaled_font_t *unscaled_font);
Index: cairo-ft.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo-ft.h 21 Jan 2005 22:33:48 -0000 1.2
+++ cairo-ft.h 7 Apr 2005 18:04:00 -0000 1.3
@@ -49,23 +49,18 @@
CAIRO_BEGIN_DECLS
-cairo_font_t *
-cairo_ft_font_create (FcPattern *pattern,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_ft_font_face_create_for_pattern (FcPattern *pattern);
-cairo_font_t *
-cairo_ft_font_create_for_ft_face (FT_Face face,
- int load_flags,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_ft_font_face_create_for_ft_face (FT_Face face,
+ int load_flags);
FT_Face
-cairo_ft_font_lock_face (cairo_font_t *ft_font);
+cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *scaled_font);
void
-cairo_ft_font_unlock_face (cairo_font_t *ft_font);
-
-FcPattern *
-cairo_ft_font_get_pattern (cairo_font_t *ft_font);
+cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *scaled_font);
CAIRO_END_DECLS
Index: cairo-gstate-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate-private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-gstate-private.h 4 Apr 2005 13:49:19 -0000 1.3
+++ cairo-gstate-private.h 7 Apr 2005 18:04:00 -0000 1.4
@@ -59,7 +59,8 @@
cairo_font_slant_t font_slant;
cairo_font_weight_t font_weight;
- cairo_font_t *font; /* Specific to the current CTM */
+ cairo_font_face_t *font_face;
+ cairo_scaled_font_t *scaled_font; /* Specific to the current CTM */
cairo_surface_t *surface;
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- cairo-gstate.c 7 Apr 2005 17:01:49 -0000 1.103
+++ cairo-gstate.c 7 Apr 2005 18:04:00 -0000 1.104
@@ -51,6 +51,9 @@
static cairo_status_t
_cairo_gstate_ensure_font (cairo_gstate_t *gstate);
+static cairo_status_t
+_cairo_gstate_ensure_font_face (cairo_gstate_t *gstate);
+
static void
_cairo_gstate_unset_font (cairo_gstate_t *gstate);
@@ -92,11 +95,8 @@
gstate->num_dashes = 0;
gstate->dash_offset = 0.0;
- gstate->font_family = NULL;
- gstate->font_slant = CAIRO_FONT_SLANT_DEFAULT;
- gstate->font_weight = CAIRO_FONT_WEIGHT_DEFAULT;
-
- gstate->font = NULL;
+ gstate->scaled_font = NULL;
+ gstate->font_face = NULL;
gstate->surface = NULL;
@@ -139,23 +139,18 @@
memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double));
}
- if (other->font_family) {
- gstate->font_family = strdup (other->font_family);
- if (!gstate->font_family)
- goto CLEANUP_DASH;
- }
-
- if (other->font) {
- gstate->font = other->font;
- cairo_font_reference (gstate->font);
- }
-
if (other->clip.region)
{
gstate->clip.region = pixman_region_create ();
pixman_region_copy (gstate->clip.region, other->clip.region);
}
+ if (gstate->font_face)
+ cairo_font_face_reference (gstate->font_face);
+
+ if (gstate->scaled_font)
+ cairo_scaled_font_reference (gstate->scaled_font);
+
cairo_surface_reference (gstate->surface);
cairo_surface_reference (gstate->clip.surface);
@@ -175,15 +170,9 @@
_cairo_path_fixed_fini (&gstate->path);
CLEANUP_FONT:
- cairo_font_destroy (gstate->font);
- gstate->font = NULL;
+ cairo_scaled_font_destroy (gstate->scaled_font);
+ gstate->scaled_font = NULL;
- if (gstate->font_family) {
- free (gstate->font_family);
- gstate->font_family = NULL;
- }
-
- CLEANUP_DASH:
free (gstate->dash);
gstate->dash = NULL;
@@ -193,11 +182,11 @@
void
_cairo_gstate_fini (cairo_gstate_t *gstate)
{
- if (gstate->font_family)
- free (gstate->font_family);
+ if (gstate->font_face)
+ cairo_font_face_destroy (gstate->font_face);
- if (gstate->font)
- cairo_font_destroy (gstate->font);
+ if (gstate->scaled_font)
+ cairo_scaled_font_destroy (gstate->scaled_font);
if (gstate->surface)
cairo_surface_destroy (gstate->surface);
@@ -2123,9 +2112,9 @@
static void
_cairo_gstate_unset_font (cairo_gstate_t *gstate)
{
- if (gstate->font) {
- cairo_font_destroy (gstate->font);
- gstate->font = NULL;
+ if (gstate->scaled_font) {
+ cairo_scaled_font_destroy (gstate->scaled_font);
+ gstate->scaled_font = NULL;
}
}
@@ -2135,20 +2124,15 @@
cairo_font_slant_t slant,
cairo_font_weight_t weight)
{
- char *new_family;
+ cairo_font_face_t *font_face;
- new_family = strdup (family);
- if (!new_family)
+ font_face = _cairo_simple_font_face_create (family, slant, weight);
+ if (!font_face)
return CAIRO_STATUS_NO_MEMORY;
-
- _cairo_gstate_unset_font (gstate);
-
- gstate->font_family = new_family;
- gstate->font_slant = slant;
- gstate->font_weight = weight;
- cairo_matrix_init_identity (&gstate->font_matrix);
-
+ _cairo_gstate_set_font_face (gstate, font_face);
+ cairo_font_face_destroy (font_face);
+
return CAIRO_STATUS_SUCCESS;
}
@@ -2181,16 +2165,16 @@
cairo_status_t
-_cairo_gstate_get_font (cairo_gstate_t *gstate,
- cairo_font_t **font)
+_cairo_gstate_get_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t **font_face)
{
cairo_status_t status;
- status = _cairo_gstate_ensure_font (gstate);
+ status = _cairo_gstate_ensure_font_face (gstate);
if (status)
return status;
- *font = gstate->font;
+ *font_face = gstate->font_face;
return CAIRO_STATUS_SUCCESS;
}
@@ -2225,11 +2209,10 @@
* independently scale the user coordinate system *or* the font matrix, in
* order to adjust the rendered size of the font.
*
- * The only font type exposed to the user is cairo_font_t which is a
- * a font specialized to a particular scale matrix, CTM, and target
- * surface. The user is responsible for not using a cairo_font_t
- * after changing the parameters; doing so will produce garbled metrics.
- *
+ * Metrics are returned in user space, whether they are obtained from
+ * the currently selected font in a #cairo_t or from a #cairo_scaled_font_t
+ * which is aa font specialized to a particular scale matrix, CTM, and target
+ * surface.
*
* The font's view
* ---------------
@@ -2288,61 +2271,51 @@
*
*/
-void
-_cairo_gstate_get_font_scale (cairo_gstate_t *gstate,
- cairo_font_scale_t *sc)
+static cairo_status_t
+_cairo_gstate_ensure_font_face (cairo_gstate_t *gstate)
{
- cairo_matrix_t tmp;
- double dummy;
- cairo_matrix_multiply (&tmp, &gstate->font_matrix, &gstate->ctm);
- cairo_matrix_get_affine (&tmp,
- &sc->matrix[0][0],
- &sc->matrix[0][1],
- &sc->matrix[1][0],
- &sc->matrix[1][1],
- &dummy, &dummy);
+ if (!gstate->font_face) {
+ gstate->font_face = _cairo_simple_font_face_create (CAIRO_FONT_FAMILY_DEFAULT,
+ CAIRO_FONT_SLANT_DEFAULT,
+ CAIRO_FONT_WEIGHT_DEFAULT);
+ if (!gstate->font_face)
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
}
-
+
static cairo_status_t
_cairo_gstate_ensure_font (cairo_gstate_t *gstate)
{
- cairo_font_scale_t sc;
cairo_status_t status;
- const char *family;
- if (gstate->font)
+ if (gstate->scaled_font)
return CAIRO_STATUS_SUCCESS;
- _cairo_gstate_get_font_scale (gstate, &sc);
-
- if (gstate->font_family)
- family = gstate->font_family;
- else
- family = CAIRO_FONT_FAMILY_DEFAULT;
-
- status = _cairo_font_create (family,
- gstate->font_slant,
- gstate->font_weight,
- &sc,
- &gstate->font);
-
+ status = _cairo_gstate_ensure_font_face (gstate);
if (status)
return status;
+ gstate->scaled_font = cairo_scaled_font_create (gstate->font_face,
+ &gstate->font_matrix,
+ &gstate->ctm);
+
+ if (!gstate->scaled_font)
+ return CAIRO_STATUS_NO_MEMORY;
+
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
- cairo_font_extents_t *extents)
+ cairo_font_extents_t *extents)
{
cairo_status_t status = _cairo_gstate_ensure_font (gstate);
if (status)
return status;
- return cairo_font_extents (gstate->font,
- &gstate->font_matrix,
- extents);
+ return cairo_scaled_font_extents (gstate->scaled_font, extents);
}
cairo_status_t
@@ -2372,8 +2345,8 @@
&origin_x, &origin_y);
}
- status = _cairo_font_text_to_glyphs (gstate->font,
- utf8, glyphs, num_glyphs);
+ status = _cairo_scaled_font_text_to_glyphs (gstate->scaled_font,
+ utf8, glyphs, num_glyphs);
if (status || !glyphs || !num_glyphs || !(*glyphs) || !(num_glyphs))
return status;
@@ -2394,16 +2367,19 @@
}
cairo_status_t
-_cairo_gstate_set_font (cairo_gstate_t *gstate,
- cairo_font_t *font)
+_cairo_gstate_set_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t *font_face)
{
- if (font != gstate->font) {
- if (gstate->font)
- cairo_font_destroy (gstate->font);
- gstate->font = font;
- if (gstate->font)
- cairo_font_reference (gstate->font);
+ if (font_face != gstate->font_face) {
+ if (gstate->font_face)
+ cairo_font_face_destroy (gstate->font_face);
+ gstate->font_face = font_face;
+ if (gstate->font_face)
+ cairo_font_face_reference (gstate->font_face);
}
+
+ cairo_matrix_init_identity (&gstate->font_matrix);
+ _cairo_gstate_unset_font (gstate);
return CAIRO_STATUS_SUCCESS;
}
@@ -2420,10 +2396,9 @@
if (status)
return status;
- cairo_font_glyph_extents (gstate->font,
- &gstate->font_matrix,
- glyphs, num_glyphs,
- extents);
+ cairo_scaled_font_glyph_extents (gstate->scaled_font,
+ glyphs, num_glyphs,
+ extents);
return CAIRO_STATUS_SUCCESS;
}
@@ -2456,9 +2431,9 @@
&transformed_glyphs[i].y);
}
- status = _cairo_font_glyph_bbox (gstate->font,
- transformed_glyphs, num_glyphs,
- &bbox);
+ status = _cairo_scaled_font_glyph_bbox (gstate->scaled_font,
+ transformed_glyphs, num_glyphs,
+ &bbox);
_cairo_box_round_to_rectangle (&bbox, &extents);
if (status)
@@ -2499,13 +2474,13 @@
_cairo_pattern_init_solid (&pattern.solid, 1.0, 1.0, 1.0);
- status = _cairo_font_show_glyphs (gstate->font,
- CAIRO_OPERATOR_ADD,
- &pattern.base, intermediate,
- extents.x, extents.y,
- 0, 0,
- extents.width, extents.height,
- transformed_glyphs, num_glyphs);
+ status = _cairo_scaled_font_show_glyphs (gstate->scaled_font,
+ CAIRO_OPERATOR_ADD,
+ &pattern.base, intermediate,
+ extents.x, extents.y,
+ 0, 0,
+ extents.width, extents.height,
+ transformed_glyphs, num_glyphs);
_cairo_pattern_fini (&pattern.base);
@@ -2553,13 +2528,13 @@
{
_cairo_gstate_pattern_init_copy (gstate, &pattern, gstate->pattern);
- status = _cairo_font_show_glyphs (gstate->font,
- gstate->operator, &pattern.base,
- gstate->surface,
- extents.x, extents.y,
- extents.x, extents.y,
- extents.width, extents.height,
- transformed_glyphs, num_glyphs);
+ status = _cairo_scaled_font_show_glyphs (gstate->scaled_font,
+ gstate->operator, &pattern.base,
+ gstate->surface,
+ extents.x, extents.y,
+ extents.x, extents.y,
+ extents.width, extents.height,
+ transformed_glyphs, num_glyphs);
_cairo_pattern_fini (&pattern.base);
}
@@ -2591,9 +2566,9 @@
&(transformed_glyphs[i].y));
}
- status = _cairo_font_glyph_path (gstate->font,
- transformed_glyphs, num_glyphs,
- &gstate->path);
+ status = _cairo_scaled_font_glyph_path (gstate->scaled_font,
+ transformed_glyphs, num_glyphs,
+ &gstate->path);
free (transformed_glyphs);
return status;
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cairo-pdf-surface.c 7 Apr 2005 17:01:49 -0000 1.25
+++ cairo-pdf-surface.c 7 Apr 2005 18:04:00 -0000 1.26
@@ -1765,13 +1765,13 @@
static cairo_pdf_font_t *
_cairo_pdf_document_get_font (cairo_pdf_document_t *document,
- cairo_font_t *font)
+ cairo_scaled_font_t *scaled_font)
{
cairo_unscaled_font_t *unscaled_font;
cairo_pdf_font_t *pdf_font;
unsigned int num_fonts, i;
- unscaled_font = _cairo_ft_font_get_unscaled_font (font);
+ unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font);
num_fonts = _cairo_array_num_elements (&document->fonts);
for (i = 0; i < num_fonts; i++) {
@@ -1795,7 +1795,7 @@
}
static cairo_status_t
-_cairo_pdf_surface_show_glyphs (cairo_font_t *font,
+_cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -1814,7 +1814,7 @@
cairo_pdf_font_t *pdf_font;
int i, index;
- pdf_font = _cairo_pdf_document_get_font (document, font);
+ pdf_font = _cairo_pdf_document_get_font (document, scaled_font);
if (pdf_font == NULL)
return CAIRO_STATUS_NO_MEMORY;
@@ -1828,10 +1828,10 @@
_cairo_output_stream_printf (output,
" %f %f %f %f %f %f Tm (\\%o) Tj",
- font->scale.matrix[0][0],
- font->scale.matrix[0][1],
- font->scale.matrix[1][0],
- -font->scale.matrix[1][1],
+ scaled_font->scale.xx,
+ scaled_font->scale.yx,
+ scaled_font->scale.xy,
+ -scaled_font->scale.yy,
glyphs[i].x,
glyphs[i].y,
index);
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- cairo-surface.c 7 Apr 2005 17:01:49 -0000 1.52
+++ cairo-surface.c 7 Apr 2005 18:04:00 -0000 1.53
@@ -914,7 +914,7 @@
}
cairo_status_t
-_cairo_surface_show_glyphs (cairo_font_t *font,
+_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
cairo_surface_t *dst,
@@ -933,7 +933,7 @@
return CAIRO_STATUS_SURFACE_FINISHED;
if (dst->backend->show_glyphs != NULL)
- status = dst->backend->show_glyphs (font, operator, pattern, dst,
+ status = dst->backend->show_glyphs (scaled_font, operator, pattern, dst,
source_x, source_y,
dest_x, dest_y,
width, height,
Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cairo-win32-font.c 7 Apr 2005 17:01:49 -0000 1.12
+++ cairo-win32-font.c 7 Apr 2005 18:04:00 -0000 1.13
@@ -47,12 +47,12 @@
#define CLEARTYPE_QUALITY 5
#endif
-const cairo_font_backend_t cairo_win32_font_backend;
+const cairo_scaleD_font_backend_t cairo_win32_scaled_font_backend;
#define LOGICAL_SCALE 32
typedef struct {
- cairo_font_t base;
+ cairo_scaled_font_t base;
[...1000 lines suppressed...]
- * @font: a #cairo_font_t from the Win32 font backend
+ * cairo_win32_scaled_font_get_metrics_factor:
+ * @scaled_font: a #cairo_scaled_font_t from the Win32 font backend
*
* Gets a scale factor between logical coordinates in the coordinate
- * space used by cairo_win32_font_select_font() and font space coordinates.
+ * space used by cairo_win32_scaled_font_select_font() (that is, the
+ * coordinate system used by the Windows functions to return metrics) and
+ * font space coordinates.
*
* Return value: factor to multiply logical units by to get font space
* coordinates.
**/
double
-cairo_win32_font_get_scale_factor (cairo_font_t *font)
+cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font)
{
- return 1. / ((cairo_win32_font_t *)font)->logical_scale;
+ return 1. / ((cairo_win32_scaled_font_t *)font)->logical_scale;
}
Index: cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cairo-win32-surface.c 4 Apr 2005 13:49:19 -0000 1.14
+++ cairo-win32-surface.c 7 Apr 2005 18:04:00 -0000 1.15
@@ -818,7 +818,7 @@
}
static cairo_status_t
-_cairo_win32_surface_show_glyphs (cairo_font_t *font,
+_cairo_win32_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
Index: cairo-win32.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cairo-win32.h 21 Feb 2005 02:19:10 -0000 1.6
+++ cairo-win32.h 7 Apr 2005 18:04:00 -0000 1.7
@@ -50,19 +50,18 @@
cairo_surface_t *
cairo_win32_surface_create (HDC hdc);
-cairo_font_t *
-cairo_win32_font_create_for_logfontw (LOGFONTW *logfont,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
cairo_status_t
-cairo_win32_font_select_font (cairo_font_t *font,
- HDC hdc);
+cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font,
+ HDC hdc);
void
-cairo_win32_font_done_font (cairo_font_t *font);
+cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font);
double
-cairo_win32_font_get_scale_factor (cairo_font_t *font);
+cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font);
#endif /* CAIRO_HAS_WIN32_SURFACE */
Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cairo-xlib-surface.c 7 Apr 2005 17:01:49 -0000 1.56
+++ cairo-xlib-surface.c 7 Apr 2005 18:04:00 -0000 1.57
@@ -848,7 +848,7 @@
}
static cairo_status_t
-_cairo_xlib_surface_show_glyphs (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -1318,7 +1318,7 @@
#define N_STACK_BUF 1024
static cairo_status_t
-_cairo_xlib_surface_show_glyphs32 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1395,7 +1395,7 @@
static cairo_status_t
-_cairo_xlib_surface_show_glyphs16 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1471,7 +1471,7 @@
}
static cairo_status_t
-_cairo_xlib_surface_show_glyphs8 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1548,7 +1548,7 @@
static cairo_status_t
-_cairo_xlib_surface_show_glyphs (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -1603,7 +1603,7 @@
/* Work out the index size to use. */
elt_size = 8;
- _cairo_font_get_glyph_cache_key (font, &key);
+ _cairo_scaled_font_get_glyph_cache_key (scaled_font, &key);
for (i = 0; i < num_glyphs; ++i) {
key.index = glyphs[i].index;
@@ -1631,17 +1631,17 @@
/* Call the appropriate sub-function. */
if (elt_size == 8)
- status = _cairo_xlib_surface_show_glyphs8 (font, operator, g, &key, src, self,
+ status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
else if (elt_size == 16)
- status = _cairo_xlib_surface_show_glyphs16 (font, operator, g, &key, src, self,
+ status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
else
- status = _cairo_xlib_surface_show_glyphs32 (font, operator, g, &key, src, self,
+ status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- cairo.c 7 Apr 2005 17:01:49 -0000 1.72
+++ cairo.c 7 Apr 2005 18:04:00 -0000 1.73
@@ -1531,51 +1531,41 @@
}
/**
- * cairo_get_font:
+ * cairo_get_font_face:
* @cr: a #cairo_t
*
- * Gets the current font object for a #cairo_t. If there is no current
- * font object, because the font parameters, transform, or target
- * surface has been changed since a font was last used, a font object
- * will be created and stored in in the #cairo_t.
+ * Gets the current font face for a #cairo_t.
*
* Return value: the current font object. Can return %NULL
* on out-of-memory or if the context is already in
* an error state. This object is owned by cairo. To keep
* a reference to it, you must call cairo_font_reference().
**/
-cairo_font_t *
-cairo_get_font (cairo_t *cr)
+cairo_font_face_t *
+cairo_get_font_face (cairo_t *cr)
{
- cairo_font_t *ret;
+ cairo_font_face_t *font_face;
CAIRO_CHECK_SANITY (cr);
if (cr->status)
return NULL;
- cr->status = _cairo_gstate_get_font (cr->gstate, &ret);
+ cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face);
CAIRO_CHECK_SANITY (cr);
- return ret;
+ return font_face;
}
-DEPRECATE (cairo_current_font, cairo_get_font);
/**
- * cairo_get_font_extents:
+ * cairo_font_extents:
* @cr: a #cairo_t
* @extents: a #cairo_font_extents_t object into which the results
* will be stored.
*
- * Gets the font extents for the current font. This is a convenience
- * function that is equivalent to:
- *
- * cairo_font_extents (cairo_get_font (cr));
- *
- * XXX: This function seems gratuitous to me, shall we drop it?
- * (cworth)
+ * Gets the font extents for the currently selected font.
**/
void
-cairo_get_font_extents (cairo_t *cr,
- cairo_font_extents_t *extents)
+cairo_font_extents (cairo_t *cr,
+ cairo_font_extents_t *extents)
{
CAIRO_CHECK_SANITY (cr);
if (cr->status)
@@ -1584,32 +1574,27 @@
cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents);
CAIRO_CHECK_SANITY (cr);
}
-DEPRECATE (cairo_current_font_extents, cairo_get_font_extents);
+DEPRECATE (cairo_current_font_extents, cairo_font_extents);
+DEPRECATE (cairo_get_font_extents, cairo_font_extents);
/**
- * cairo_set_font:
+ * cairo_set_font_face:
* @cr: a #cairo_t
- * @font: a #cairo_font_t, or %NULL to unset any previously set font.
- *
- * Replaces the current #cairo_font_t object in the #cairo_t with
- * @font. The replaced font in the #cairo_t will be destroyed if there
- * are no other references to it. Since a #cairo_font_t is specific to
- * a particular output device and size, changing the transformation,
- * font transformation, or target surfaces of a #cairo_t will clear
- * any previously set font. Setting the font using cairo_set_font() is
- * exclusive with the simple font selection API provided by
- * cairo_select_font(). The size and transformation set by
- * cairo_scale_font() and cairo_transform_font() are ignored unless
- * they were taken into account when creating @font.
+ * @font_face: a #cairo_font_face_t, or %NULL to restore to the default font
+ *
+ * Replaces the current #cairo_font_face_t object in the #cairo_t with
+ * @font_face. The replaced font face in the #cairo_t will be
+ * destroyed if there are no other references to it.
**/
void
-cairo_set_font (cairo_t *cr, cairo_font_t *font)
+cairo_set_font_face (cairo_t *cr,
+ cairo_font_face_t *font_face)
{
CAIRO_CHECK_SANITY (cr);
if (cr->status)
return;
- cr->status = _cairo_gstate_set_font (cr->gstate, font);
+ cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face);
CAIRO_CHECK_SANITY (cr);
}
@@ -1621,16 +1606,6 @@
* Scale the current font by the factor @scale. This function is
* designed to work well with cairo_select_font(), and will usually be
* called immediately afterwards to set the desired font size.
- *
- * If this function is called after a #cairo_font_t has been set by
- * cairo_font_t() then that font will be discarded from the
- * #cairo_t. Instead, cairo_scale_font will operate on the last font
- * selected by cairo_select_font(), or the default font if
- * cairo_select_font() has never been called.
- *
- * XXX: The interaction with cairo_set_font described above is very
- * confusing and violates the principle of least surprise. I think
- * this is an API bug that we should resolve somehow (cworth).
**/
void
cairo_scale_font (cairo_t *cr, double scale)
@@ -1654,16 +1629,6 @@
* either cairo_transform_font() or cairo_scale_font().
*
* This function is designed to work well with cairo_select_font().
- *
- * If this function is called after a #cairo_font_t has been set by
- * cairo_font_t() then that font will be discarded from the
- * #cairo_t. Instead, cairo_scale_font will operate on the last font
- * selected by cairo_select_font(), or the default font if
- * cairo_select_font() has never been called.
- *
- * XXX: The interaction with cairo_set_font described above is very
- * confusing and violates the principle of least surprise. I think
- * this is an API bug that we should resolve somehow (cworth).
**/
void
cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix)
Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- cairo.h 7 Apr 2005 17:01:49 -0000 1.92
+++ cairo.h 7 Apr 2005 18:04:00 -0000 1.93
@@ -456,16 +456,26 @@
/* Font/Text functions */
/**
- * cairo_font_t:
+ * cairo_scaled_font_t:
*
- * A #cairo_font_t is a font scaled to a particular size and device
- * resolution. A font can be set on a #cairo_t by using
- * cairo_set_font() assuming that the current transformation and
- * target surface of the #cairo_t match that for which the
- * #cairo_font_t was created. The effect of using a mismatched
- * #cairo_font_t will be incorrect font metrics.
+ * A #cairo_scaled_font_t is a font scaled to a particular size and device
+ * resolution. A cairo_scaled_font_t is most useful for low-level font
+ * usage where a library or application wants to cache a reference
+ * to a scaled font to speed up the computation of metrics.
*/
-typedef struct _cairo_font cairo_font_t;
+typedef struct _cairo_scaled_font cairo_scaled_font_t;
+
+/**
+ * cairo_font_face_t:
+ *
+ * A #cairo_font_face_t specifies all aspects of a font other
+ * than the size or font matrix (a font matrix is used to distort
+ * a font by sheering it or scaling it unequally in the two
+ * directions) . A font face can be set on a #cairo_t by using
+ * cairo_set_font_face(); the size and font matrix are set with
+ * cairo_scale_font() and cairo_transform_font().
+ */
+typedef struct _cairo_font_face cairo_font_face_t;
/**
* cairo_glyph_t:
@@ -573,15 +583,15 @@
void
cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
-cairo_font_t *
-cairo_get_font (cairo_t *cr);
+cairo_font_face_t *
+cairo_get_font_face (cairo_t *cr);
void
-cairo_get_font_extents (cairo_t *cr,
- cairo_font_extents_t *extents);
+cairo_font_extents (cairo_t *cr,
+ cairo_font_extents_t *extents);
void
-cairo_set_font (cairo_t *cr, cairo_font_t *font);
+cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
void
cairo_text_extents (cairo_t *cr,
@@ -600,25 +610,37 @@
void
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
+/* Generic identifier for a font style */
+
+void
+cairo_font_face_reference (cairo_font_face_t *font_face);
+
+void
+cairo_font_face_destroy (cairo_font_face_t *font_face);
+
+
/* Portable interface to general font features. */
-
+
+cairo_scaled_font_t *
+cairo_scaled_font_create (cairo_font_face_t *font_face,
+ cairo_matrix_t *font_matrix,
+ cairo_matrix_t *ctm);
+
void
-cairo_font_reference (cairo_font_t *font);
+cairo_scaled_font_reference (cairo_scaled_font_t *font);
void
-cairo_font_destroy (cairo_font_t *font);
+cairo_scaled_font_destroy (cairo_scaled_font_t *font);
cairo_status_t
-cairo_font_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_font_extents_t *extents);
+cairo_scaled_font_extents (cairo_scaled_font_t *font,
+ cairo_font_extents_t *extents);
void
-cairo_font_glyph_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents);
+cairo_scaled_font_glyph_extents (cairo_scaled_font_t *font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents);
/* Image functions */
@@ -1069,8 +1091,8 @@
release. */
#define cairo_current_path cairo_current_path_DEPRECATED_BY_cairo_get_path
#define cairo_current_path_flat cairo_current_path_flat_DEPRECATED_BY_cairo_get_path_flat
-#define cairo_current_font cairo_current_font_DEPRECATED_BY_cairo_get_font
-#define cairo_current_font_extents cairo_current_font_extents_DEPRECATED_BY_cairo_get_font_extents
+#define cairo_current_font_extents cairo_current_font_extents_DEPRECATED_BY_cairo_font_extents
+#define cairo_get_font_extents cairo_get_font_extents_DEPRECATED_BY_cairo_font_extents
#define cairo_current_operator cairo_current_operator_DEPRECATED_BY_cairo_get_operator
#define cairo_current_rgb_color cairo_current_rgb_color_DEPRECATED_BY_cairo_get_rgb_color
#define cairo_current_alpha cairo_current_alpha_DEPRECATED_BY_cairo_get_alpha
@@ -1101,7 +1123,8 @@
#define cairo_current_path cairo_get_path
#define cairo_current_path_flat cairo_get_path_flat
#define cairo_current_font cairo_get_font
-#define cairo_current_font_extents cairo_get_font_extents
+#define cairo_current_font_extents cairo_font_extents
+#define cairo_get_font_extents cairo_font_extents
#define cairo_current_operator cairo_get_operator
#define cairo_current_rgb_color cairo_get_rgb_color
#define cairo_current_alpha cairo_get_alpha
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- cairoint.h 7 Apr 2005 17:01:49 -0000 1.118
+++ cairoint.h 7 Apr 2005 18:04:00 -0000 1.119
@@ -387,25 +387,33 @@
#define CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT 0x100000
#define CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT 0x100000
-typedef struct {
- double matrix[2][2];
-} cairo_font_scale_t;
+typedef struct _cairo_unscaled_font cairo_unscaled_font_t;
-struct _cairo_font_backend;
+typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
+typedef struct _cairo_scaled_font_backend cairo_scaled_font_backend_t;
+typedef struct _cairo_font_face_backend cairo_font_face_backend_t;
/*
* A cairo_unscaled_font_t is just an opaque handle we use in the
* glyph cache.
*/
-typedef struct {
+struct _cairo_unscaled_font {
int refcount;
- const struct _cairo_font_backend *backend;
-} cairo_unscaled_font_t;
+ const cairo_unscaled_font_backend_t *backend;
+};
-struct _cairo_font {
+struct _cairo_scaled_font {
int refcount;
- cairo_font_scale_t scale; /* font space => device space */
- const struct _cairo_font_backend *backend;
+ cairo_matrix_t font_matrix; /* font space => user space */
+ cairo_matrix_t ctm; /* user space => device space */
+ cairo_matrix_t scale; /* font space => device space */
+ cairo_font_face_t *font_face; /* may be NULL */
+ const cairo_scaled_font_backend_t *backend;
+};
+
+struct _cairo_font_face {
+ int refcount;
+ const cairo_font_face_backend_t *backend;
};
/* cairo_font.c is responsible for a global glyph cache:
@@ -421,7 +429,7 @@
typedef struct {
cairo_cache_entry_base_t base;
cairo_unscaled_font_t *unscaled;
- cairo_font_scale_t scale;
+ cairo_matrix_t scale; /* translation is ignored */
int flags;
unsigned long index;
} cairo_glyph_cache_key_t;
@@ -454,15 +462,21 @@
/* the font backend interface */
-typedef struct _cairo_font_backend {
+struct _cairo_unscaled_font_backend {
+ void (*destroy) (void *unscaled_font);
+ cairo_status_t (*create_glyph) (void *unscaled_font,
+ cairo_image_glyph_cache_entry_t *entry);
+};
+
+struct _cairo_scaled_font_backend {
cairo_status_t (*create) (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight,
- cairo_font_scale_t *scale,
- cairo_font_t **font);
-
- void (*destroy_font) (void *font);
- void (*destroy_unscaled_font) (void *font);
+ cairo_matrix_t *font_matrix,
+ cairo_matrix_t *ctm,
+ cairo_scaled_font_t **font);
+
+ void (*destroy) (void *font);
cairo_status_t (*font_extents) (void *font,
cairo_font_extents_t *extents);
@@ -501,27 +515,32 @@
cairo_path_fixed_t *path);
void (*get_glyph_cache_key) (void *font,
cairo_glyph_cache_key_t *key);
+};
- cairo_status_t (*create_glyph) (cairo_image_glyph_cache_entry_t *entry);
-
-} cairo_font_backend_t;
+struct _cairo_font_face_backend {
+ void (*destroy) (void *font_face);
+ cairo_status_t (*create_font) (void *font_face,
+ cairo_matrix_t *font_matrix,
+ cairo_matrix_t *ctm,
+ cairo_scaled_font_t **scaled_font);
+};
/* concrete font backends */
#ifdef CAIRO_HAS_FT_FONT
-extern const cairo_private struct _cairo_font_backend cairo_ft_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_ft_scaled_font_backend;
#endif
#ifdef CAIRO_HAS_WIN32_FONT
-extern const cairo_private struct _cairo_font_backend cairo_win32_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_win32_scaled_font_backend;
#endif
#ifdef CAIRO_HAS_ATSUI_FONT
-extern const cairo_private struct _cairo_font_backend cairo_atsui_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_font_backend;
#endif
@@ -616,7 +635,7 @@
* surface, using image surfaces as glyphs.
*/
cairo_status_t
- (*show_glyphs) (cairo_font_t *font,
+ (*show_glyphs) (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *surface,
@@ -784,17 +803,17 @@
#if defined (CAIRO_HAS_WIN32_FONT)
#define CAIRO_FONT_FAMILY_DEFAULT "Arial"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_font_backend
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend
#elif defined (CAIRO_HAS_ATSUI_FONT)
#define CAIRO_FONT_FAMILY_DEFAULT "Monaco"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_font_backend
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend
#elif defined (CAIRO_HAS_FT_FONT)
#define CAIRO_FONT_FAMILY_DEFAULT "serif"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_font_backend
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_scaled_font_backend
#endif
@@ -1107,17 +1126,13 @@
_cairo_gstate_scale_font (cairo_gstate_t *gstate,
double scale);
-cairo_private void
-_cairo_gstate_get_font_scale (cairo_gstate_t *gstate,
- cairo_font_scale_t *sc);
-
cairo_private cairo_status_t
_cairo_gstate_transform_font (cairo_gstate_t *gstate,
cairo_matrix_t *matrix);
cairo_private cairo_status_t
-_cairo_gstate_get_font (cairo_gstate_t *gstate,
- cairo_font_t **font);
+_cairo_gstate_get_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t **font_face);
cairo_private void
_cairo_gstate_set_font_transform (cairo_gstate_t *gstate,
@@ -1132,8 +1147,8 @@
cairo_font_extents_t *extents);
cairo_private cairo_status_t
-_cairo_gstate_set_font (cairo_gstate_t *gstate,
- cairo_font_t *font);
+_cairo_gstate_set_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t *font_face);
cairo_private cairo_status_t
_cairo_gstate_text_to_glyphs (cairo_gstate_t *font,
@@ -1175,23 +1190,26 @@
cairo_private void
_cairo_color_set_alpha (cairo_color_t *color, double alpha);
-/* cairo_font.c */
+/* cairo-font.c */
-cairo_private cairo_status_t
-_cairo_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
- cairo_font_t **font);
+cairo_private void
+_cairo_font_face_init (cairo_font_face_t *font_face,
+ const cairo_font_face_backend_t *backend);
+
+cairo_private cairo_font_face_t *
+_cairo_simple_font_face_create (const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight);
cairo_private void
-_cairo_font_init (cairo_font_t *font,
- cairo_font_scale_t *scale,
- const cairo_font_backend_t *backend);
+_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
+ cairo_matrix_t *font_matrix,
+ cairo_matrix_t *ctm,
+ const cairo_scaled_font_backend_t *backend);
cairo_private void
-_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_unscaled_font_backend_t *backend);
cairo_private void
_cairo_unscaled_font_reference (cairo_unscaled_font_t *font);
@@ -1200,56 +1218,50 @@
_cairo_unscaled_font_destroy (cairo_unscaled_font_t *font);
cairo_private cairo_status_t
-_cairo_font_font_extents (cairo_font_t *font,
- cairo_font_extents_t *extents);
-
-cairo_private cairo_status_t
-_cairo_font_text_to_glyphs (cairo_font_t *font,
- const char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs);
+_cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font,
+ cairo_font_extents_t *extents);
cairo_private cairo_status_t
-_cairo_font_glyph_extents (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents);
+_cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs);
cairo_private cairo_status_t
-_cairo_font_glyph_bbox (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox);
+_cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents);
cairo_private cairo_status_t
-_cairo_font_show_glyphs (cairo_font_t *font,
- cairo_operator_t operator,
- cairo_pattern_t *source,
- cairo_surface_t *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int widht,
- unsigned int height,
- cairo_glyph_t *glyphs,
- int num_glyphs);
+_cairo_scaled_font_glyph_bbox (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_box_t *bbox);
cairo_private cairo_status_t
-_cairo_font_glyph_path (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_fixed_t *path);
+_cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_surface_t *surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ cairo_glyph_t *glyphs,
+ int num_glyphs);
cairo_private cairo_status_t
-_cairo_font_glyph_path (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_fixed_t *path);
+_cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path);
cairo_private void
-_cairo_font_get_glyph_cache_key (cairo_font_t *font,
- cairo_glyph_cache_key_t *key);
+_cairo_scaled_font_get_glyph_cache_key (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_cache_key_t *key);
/* cairo_hull.c */
cairo_private cairo_status_t
@@ -1445,7 +1457,7 @@
_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region);
cairo_private cairo_status_t
-_cairo_surface_show_glyphs (cairo_font_t *font,
+_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
cairo_surface_t *surface,
- Previous message: [cairo-commit] cairo/doc/public/tmpl cairo-font.sgml, NONE,
1.1 cairo-ft.sgml, 1.2, 1.3 cairo-matrix.sgml, 1.3,
1.4 cairo-pdf.sgml, 1.3, 1.4 cairo-png.sgml, 1.2,
1.3 cairo-surface.sgml, 1.5, 1.6 cairo.sgml, 1.5, 1.6
- Next message: [cairo-commit] cairo ChangeLog,1.475,1.476
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list