mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 02:38:07 +02:00
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.
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. Implement font_face parameter to _cairo_scaled_font_init, moving the reference of the font_face from _cairo_inner_font_cache_create_entry. Add a font_face parameter in addition to the unscaled_font parameter. Track new font_face parameter to _cairo_ft_scaled_font_create. Whitespace touchup. Reviewed by: otaylor
This commit is contained in:
parent
b25c1203d8
commit
34c9e242c8
6 changed files with 77 additions and 33 deletions
31
ChangeLog
31
ChangeLog
|
|
@ -1,3 +1,34 @@
|
|||
2005-08-08 Carl Worth <cworth@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.
|
||||
|
||||
2005-08-10 Billy Biggs <vektor@dumbterm.net>
|
||||
|
||||
* test/clip-operator-ref.png: Update to match the output from
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_matrix_t *scale)
|
|||
|
||||
|
||||
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 @@ _cairo_atsui_font_create_toy(const cairo_toy_font_face_t *toy_face,
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -454,6 +454,7 @@ _cairo_toy_font_face_create (const char *family,
|
|||
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 @@ static const cairo_scaled_font_t _cairo_scaled_font_nil = {
|
|||
CAIRO_SUBPIXEL_ORDER_DEFAULT,
|
||||
CAIRO_HINT_STYLE_DEFAULT,
|
||||
CAIRO_HINT_METRICS_DEFAULT} ,
|
||||
NULL, /* font_face */
|
||||
CAIRO_SCALED_FONT_BACKEND_DEFAULT,
|
||||
};
|
||||
|
||||
|
|
@ -748,9 +748,6 @@ _cairo_inner_font_cache_create_entry (void *cache,
|
|||
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 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
|
|||
|
||||
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 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
|
|||
{
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,13 @@ struct _cairo_ft_font_face {
|
|||
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 @@ const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend = {
|
|||
|
||||
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 @@ _get_options_load_flags (const cairo_font_options_t *options)
|
|||
}
|
||||
|
||||
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 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
|
|||
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 @@ _cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font)
|
|||
}
|
||||
|
||||
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 @@ _cairo_ft_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
|
|||
{
|
||||
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 @@ _cairo_ft_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
|
|||
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 @@ const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = {
|
|||
_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 @@ _cairo_ft_font_face_scaled_font_create (void *abstract_face,
|
|||
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 const cairo_font_face_backend_t _cairo_ft_font_face_backend = {
|
|||
|
||||
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 @@ cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *abstract_font)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ _get_system_quality (void)
|
|||
|
||||
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 @@ _win32_scaled_font_create (LOGFONTW *logfont,
|
|||
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 @@ _cairo_win32_scaled_font_done_unscaled_font (cairo_scaled_font_t *scaled_font)
|
|||
/* 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 @@ _cairo_win32_scaled_font_create_toy (const cairo_toy_font_face_t *toy_face,
|
|||
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_scaled_font_create (void *abstract_face,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -479,11 +479,11 @@ struct _cairo_font_options {
|
|||
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 @@ typedef struct _cairo_toy_font_face {
|
|||
|
||||
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_unscaled_font_destroy (cairo_unscaled_font_t *font);
|
|||
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue