[cairo-commit]
cairo/src cairo-atsui-font.c, 1.19, 1.20 cairo-font.c,
1.65, 1.66 cairo-ft-font.c, 1.96, 1.97 cairo-win32-font.c,
1.37, 1.38 cairoint.h, 1.190, 1.191
Carl Worth
commit at pdx.freedesktop.org
Thu Aug 11 06:35:24 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv8241/src
Modified Files:
cairo-atsui-font.c cairo-font.c cairo-ft-font.c
cairo-win32-font.c cairoint.h
Log Message:
2005-08-08 Carl Worth <cworth at cworth.org>
Reviewed by: otaylor
* src/cairoint.h: Re-order cairo_scaled_font->font_face parameter
to maintain the font_face,font_matrix,ctm,options order that
prevails throughout the implementation. Add font_face parameter to
_cairo_scaled_font_init.
* src/cairoint.h:
* src/cairo-atsui-font.c: (_cairo_atsui_font_create_toy):
* src/cairo-win32-font.c: (_cairo_win32_scaled_font_create_toy):
* src/cairo-ft-font.c: (_cairo_ft_scaled_font_create_toy):
Remove const qualifier from toy_face parameter to creat_toy, as
these functions may reference the font face. Track addition of
font_face parameter to _cairo_scaled_font_init.
* src/cairo-font.c: (_cairo_inner_font_cache_create_entry),
(_cairo_scaled_font_init): Implement font_face parameter to
_cairo_scaled_font_init, moving the reference of the font_face
from _cairo_inner_font_cache_create_entry.
* src/cairo-ft-font.c: (_cairo_ft_scaled_font_create): Add a
font_face parameter in addition to the unscaled_font parameter.
* src/cairo-ft-font.c: (_cairo_ft_font_face_scaled_font_create):
Track new font_face parameter to _cairo_ft_scaled_font_create.
* src/cairo-ft-font.c: (_cairo_ft_font_face_create),
(cairo_ft_scaled_font_lock_face): Whitespace touchup.
Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cairo-atsui-font.c 9 Aug 2005 17:05:35 -0000 1.19
+++ cairo-atsui-font.c 11 Aug 2005 13:35:21 -0000 1.20
@@ -105,7 +105,7 @@
static cairo_status_t
-_cairo_atsui_font_create_toy(const cairo_toy_font_face_t *toy_face,
+_cairo_atsui_font_create_toy(cairo_toy_font_face_t *toy_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -187,7 +187,7 @@
font = malloc(sizeof(cairo_atsui_font_t));
- _cairo_scaled_font_init(&font->base, font_matrix, ctm, options,
+ _cairo_scaled_font_init(&font->base, toy_face, font_matrix, ctm, options,
&cairo_atsui_scaled_font_backend);
cairo_matrix_multiply(&scale, font_matrix, ctm);
Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cairo-font.c 6 Aug 2005 03:53:09 -0000 1.65
+++ cairo-font.c 11 Aug 2005 13:35:21 -0000 1.66
@@ -454,6 +454,7 @@
static const cairo_scaled_font_t _cairo_scaled_font_nil = {
CAIRO_STATUS_NO_MEMORY, /* status */
-1, /* ref_count */
+ NULL, /* font_face */
{ 1., 0., 0., 1., 0, 0}, /* font_matrix */
{ 1., 0., 0., 1., 0, 0}, /* ctm */
{ 1., 0., 0., 1., 0, 0}, /* scale */
@@ -461,7 +462,6 @@
CAIRO_SUBPIXEL_ORDER_DEFAULT,
CAIRO_HINT_STYLE_DEFAULT,
CAIRO_HINT_METRICS_DEFAULT} ,
- NULL, /* font_face */
CAIRO_SCALED_FONT_BACKEND_DEFAULT,
};
@@ -748,9 +748,6 @@
return status;
}
- entry->scaled_font->font_face = k->font_face;
- cairo_font_face_reference (k->font_face);
-
entry->key.base.memory = 0;
entry->key.font_face = k->font_face;
entry->key.font_matrix = &entry->scaled_font->font_matrix;
@@ -857,6 +854,7 @@
void
_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
+ cairo_font_face_t *font_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -864,6 +862,7 @@
{
scaled_font->status = CAIRO_STATUS_SUCCESS;
+ scaled_font->font_face = cairo_font_face_reference (font_face);
scaled_font->font_matrix = *font_matrix;
scaled_font->ctm = *ctm;
cairo_matrix_multiply (&scaled_font->scale, &scaled_font->font_matrix, &scaled_font->ctm);
Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- cairo-ft-font.c 8 Aug 2005 20:46:11 -0000 1.96
+++ cairo-ft-font.c 11 Aug 2005 13:35:21 -0000 1.97
@@ -119,6 +119,13 @@
cairo_ft_font_face_t *next;
};
+static cairo_font_face_t *
+_cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled,
+ int load_flags);
+
+static void
+_cairo_ft_font_face_destroy (void *abstract_face);
+
const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend;
/**
@@ -1266,8 +1273,8 @@
typedef struct _cairo_ft_scaled_font {
cairo_scaled_font_t base;
- int load_flags;
cairo_ft_unscaled_font_t *unscaled;
+ int load_flags;
} cairo_ft_scaled_font_t;
const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend;
@@ -1418,7 +1425,8 @@
}
static cairo_scaled_font_t *
-_cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
+_cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
+ cairo_font_face_t *font_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -1430,18 +1438,19 @@
if (scaled_font == NULL)
return NULL;
- scaled_font->unscaled = unscaled;
+ _cairo_scaled_font_init (&scaled_font->base,
+ font_face,
+ font_matrix, ctm, options,
+ &cairo_ft_scaled_font_backend);
+
_cairo_unscaled_font_reference (&unscaled->base);
-
+ scaled_font->unscaled = unscaled;
+
if (options->hint_metrics != CAIRO_HINT_METRICS_OFF)
load_flags |= PRIVATE_FLAG_HINT_METRICS;
scaled_font->load_flags = load_flags;
- _cairo_scaled_font_init (&scaled_font->base,
- font_matrix, ctm, options,
- &cairo_ft_scaled_font_backend);
-
return (cairo_scaled_font_t*) scaled_font;
}
@@ -1452,7 +1461,7 @@
}
static cairo_status_t
-_cairo_ft_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
+_cairo_ft_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -1460,7 +1469,7 @@
{
FcPattern *pattern, *resolved;
cairo_ft_unscaled_font_t *unscaled;
- cairo_scaled_font_t *new_font;
+ cairo_scaled_font_t *new_font = NULL;
FcResult result;
int fcslant;
int fcweight;
@@ -1523,29 +1532,26 @@
goto FREE_RESOLVED;
load_flags = _get_pattern_load_flags (pattern);
+
new_font = _cairo_ft_scaled_font_create (unscaled,
+ &toy_face->base,
font_matrix, ctm,
options, load_flags);
_cairo_unscaled_font_destroy (&unscaled->base);
+ FREE_RESOLVED:
FcPatternDestroy (resolved);
+
+ FREE_PATTERN:
FcPatternDestroy (pattern);
if (new_font) {
*font = new_font;
return CAIRO_STATUS_SUCCESS;
} else {
- return CAIRO_STATUS_NO_MEMORY; /* A guess */
+ return CAIRO_STATUS_NO_MEMORY;
}
-
- FREE_RESOLVED:
- FcPatternDestroy (resolved);
-
- FREE_PATTERN:
- FcPatternDestroy (pattern);
-
- return CAIRO_STATUS_NO_MEMORY;
}
static void
@@ -2158,7 +2164,7 @@
_cairo_ft_scaled_font_get_glyph_cache_key
};
-/* ft_font_face_t */
+/* cairo_ft_font_face_t */
static void
_cairo_ft_font_face_destroy (void *abstract_face)
@@ -2242,6 +2248,7 @@
load_flags = font_face->load_flags;
*scaled_font = _cairo_ft_scaled_font_create (font_face->unscaled,
+ &font_face->base,
font_matrix, ctm,
options, load_flags);
if (*scaled_font)
@@ -2257,7 +2264,7 @@
static cairo_font_face_t *
_cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled,
- int load_flags)
+ int load_flags)
{
cairo_ft_font_face_t *font_face;
@@ -2519,7 +2526,8 @@
return NULL;
}
- _cairo_ft_unscaled_font_set_scale (scaled_font->unscaled, &scaled_font->base.scale);
+ _cairo_ft_unscaled_font_set_scale (scaled_font->unscaled,
+ &scaled_font->base.scale);
return face;
}
Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- cairo-win32-font.c 6 Aug 2005 17:22:07 -0000 1.37
+++ cairo-win32-font.c 11 Aug 2005 13:35:21 -0000 1.38
@@ -214,6 +214,7 @@
static cairo_scaled_font_t *
_win32_scaled_font_create (LOGFONTW *logfont,
+ cairo_font_face_t *font_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options)
@@ -261,7 +262,9 @@
cairo_matrix_multiply (&scale, font_matrix, ctm);
_compute_transform (f, &scale);
- _cairo_scaled_font_init (&f->base, font_matrix, ctm, options, &cairo_win32_scaled_font_backend);
+ _cairo_scaled_font_init (&f->base, font_face,
+ font_matrix, ctm, options,
+ &cairo_win32_scaled_font_backend);
return &f->base;
}
@@ -427,7 +430,7 @@
/* implement the font backend interface */
static cairo_status_t
-_cairo_win32_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
+_cairo_win32_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -493,7 +496,8 @@
if (!logfont.lfFaceName)
return CAIRO_STATUS_NO_MEMORY;
- scaled_font = _win32_scaled_font_create (&logfont, font_matrix, ctm, options);
+ scaled_font = _win32_scaled_font_create (&logfont, toy_face,
+ font_matrix, ctm, options);
if (!scaled_font)
return CAIRO_STATUS_NO_MEMORY;
@@ -1307,6 +1311,7 @@
cairo_win32_font_face_t *font_face = abstract_face;
*font = _win32_scaled_font_create (&font_face->logfont,
+ font_face,
font_matrix, ctm, options);
if (*font)
return CAIRO_STATUS_SUCCESS;
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- cairoint.h 10 Aug 2005 13:52:40 -0000 1.190
+++ cairoint.h 11 Aug 2005 13:35:21 -0000 1.191
@@ -479,11 +479,11 @@
struct _cairo_scaled_font {
cairo_status_t status;
int ref_count;
+ cairo_font_face_t *font_face; /* may be NULL */
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_options_t options;
- cairo_font_face_t *font_face; /* may be NULL */
const cairo_scaled_font_backend_t *backend;
};
@@ -572,7 +572,7 @@
struct _cairo_scaled_font_backend {
cairo_status_t
- (*create_toy) (const cairo_toy_font_face_t *toy_face,
+ (*create_toy) (cairo_toy_font_face_t *toy_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
@@ -1386,6 +1386,7 @@
cairo_private void
_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
+ cairo_font_face_t *font_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
const cairo_font_options_t *options,
More information about the cairo-commit
mailing list