mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 08:48:00 +02:00
src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c src/cairoint.h: Move the font options into the base cairo_scaled_font_t object so that we have them available to use when we are removing a scaled font from the cache. (http://bugzilla.gnome.org/show_bug.cgi?id=#311299, Ali Akcaagac, Behdad Esfahbod)
This commit is contained in:
parent
a0ca6026ad
commit
449087745b
5 changed files with 30 additions and 15 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2005-07-29 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c
|
||||
src/cairoint.h: Move the font options into the base
|
||||
cairo_scaled_font_t object so that we have them available
|
||||
to use when we are removing a scaled font from the cache.
|
||||
(http://bugzilla.gnome.org/show_bug.cgi?id=#311299,
|
||||
Ali Akcaagac, Behdad Esfahbod)
|
||||
|
||||
2005-07-28 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo-gstate.c: (_cairo_gstate_mask): Run the mask pattern
|
||||
|
|
|
|||
|
|
@ -466,6 +466,10 @@ static const cairo_scaled_font_t _cairo_scaled_font_nil = {
|
|||
{ 1., 0., 0., 1., 0, 0}, /* font_matrix */
|
||||
{ 1., 0., 0., 1., 0, 0}, /* ctm */
|
||||
{ 1., 0., 0., 1., 0, 0}, /* scale */
|
||||
{ CAIRO_ANTIALIAS_DEFAULT, /* options */
|
||||
CAIRO_SUBPIXEL_ORDER_DEFAULT,
|
||||
CAIRO_HINT_STYLE_DEFAULT,
|
||||
CAIRO_HINT_METRICS_DEFAULT} ,
|
||||
NULL, /* font_face */
|
||||
CAIRO_SCALED_FONT_BACKEND_DEFAULT,
|
||||
};
|
||||
|
|
@ -864,6 +868,7 @@ void
|
|||
_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
|
||||
const cairo_matrix_t *font_matrix,
|
||||
const cairo_matrix_t *ctm,
|
||||
const cairo_font_options_t *options,
|
||||
const cairo_scaled_font_backend_t *backend)
|
||||
{
|
||||
scaled_font->status = CAIRO_STATUS_SUCCESS;
|
||||
|
|
@ -871,6 +876,8 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
|
|||
scaled_font->font_matrix = *font_matrix;
|
||||
scaled_font->ctm = *ctm;
|
||||
cairo_matrix_multiply (&scaled_font->scale, &scaled_font->font_matrix, &scaled_font->ctm);
|
||||
|
||||
scaled_font->options = *options;
|
||||
|
||||
scaled_font->ref_count = 1;
|
||||
scaled_font->backend = backend;
|
||||
|
|
@ -1071,6 +1078,7 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
|
|||
key.font_face = scaled_font->font_face;
|
||||
key.font_matrix = &scaled_font->font_matrix;
|
||||
key.ctm = &scaled_font->ctm;
|
||||
key.options = scaled_font->options;
|
||||
|
||||
_cairo_cache_remove (cache, &key);
|
||||
_unlock_global_font_cache ();
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,6 @@ const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend = {
|
|||
typedef struct {
|
||||
cairo_scaled_font_t base;
|
||||
int load_flags;
|
||||
cairo_font_options_t options;
|
||||
ft_unscaled_font_t *unscaled;
|
||||
} cairo_ft_scaled_font_t;
|
||||
|
||||
|
|
@ -1385,14 +1384,12 @@ _ft_scaled_font_create (ft_unscaled_font_t *unscaled,
|
|||
f->unscaled = unscaled;
|
||||
_cairo_unscaled_font_reference (&unscaled->base);
|
||||
|
||||
f->options = *options;
|
||||
|
||||
if (options->hint_metrics != CAIRO_HINT_METRICS_OFF)
|
||||
load_flags |= PRIVATE_FLAG_HINT_METRICS;
|
||||
|
||||
f->load_flags = load_flags;
|
||||
|
||||
_cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_ft_scaled_font_backend);
|
||||
_cairo_scaled_font_init (&f->base, font_matrix, ctm, options, &cairo_ft_scaled_font_backend);
|
||||
|
||||
return (cairo_scaled_font_t *)f;
|
||||
}
|
||||
|
|
@ -1611,7 +1608,7 @@ _cairo_ft_scaled_font_font_extents (void *abstract_font,
|
|||
* Get to unscaled metrics so that the upper level can get back to
|
||||
* user space
|
||||
*/
|
||||
if (scaled_font->options.hint_metrics != CAIRO_HINT_METRICS_OFF) {
|
||||
if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) {
|
||||
double x_factor, y_factor;
|
||||
|
||||
if (scaled_font->unscaled->x_scale == 0)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ typedef struct {
|
|||
cairo_scaled_font_t base;
|
||||
|
||||
LOGFONTW logfont;
|
||||
cairo_font_options_t options;
|
||||
|
||||
BYTE quality;
|
||||
|
||||
|
|
@ -227,7 +226,6 @@ _win32_scaled_font_create (LOGFONTW *logfont,
|
|||
return NULL;
|
||||
|
||||
f->logfont = *logfont;
|
||||
f->options = *options;
|
||||
|
||||
/* We don't have any control over the hinting style or subpixel
|
||||
* order in the Win32 font API, so we ignore those parts of
|
||||
|
|
@ -263,7 +261,7 @@ _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, &cairo_win32_scaled_font_backend);
|
||||
_cairo_scaled_font_init (&f->base, font_matrix, ctm, options, &cairo_win32_scaled_font_backend);
|
||||
|
||||
return &f->base;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -458,13 +458,22 @@ struct _cairo_unscaled_font {
|
|||
const cairo_unscaled_font_backend_t *backend;
|
||||
};
|
||||
|
||||
struct _cairo_font_options {
|
||||
cairo_antialias_t antialias;
|
||||
cairo_subpixel_order_t subpixel_order;
|
||||
cairo_hint_style_t hint_style;
|
||||
cairo_hint_metrics_t hint_metrics;
|
||||
};
|
||||
|
||||
struct _cairo_scaled_font {
|
||||
cairo_status_t status;
|
||||
int ref_count;
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
@ -475,13 +484,6 @@ struct _cairo_font_face {
|
|||
const cairo_font_face_backend_t *backend;
|
||||
};
|
||||
|
||||
struct _cairo_font_options {
|
||||
cairo_antialias_t antialias;
|
||||
cairo_subpixel_order_t subpixel_order;
|
||||
cairo_hint_style_t hint_style;
|
||||
cairo_hint_metrics_t hint_metrics;
|
||||
};
|
||||
|
||||
/* cairo_font.c is responsible for a global glyph cache:
|
||||
*
|
||||
* - glyph entries: [[[base], cairo_unscaled_font_t, scale, flags, index],
|
||||
|
|
@ -1320,6 +1322,7 @@ cairo_private void
|
|||
_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
|
||||
const cairo_matrix_t *font_matrix,
|
||||
const cairo_matrix_t *ctm,
|
||||
const cairo_font_options_t *options,
|
||||
const cairo_scaled_font_backend_t *backend);
|
||||
|
||||
cairo_private void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue