summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-07-29 12:45:01 +0000
committerOwen Taylor <otaylor@redhat.com>2005-07-29 12:45:01 +0000
commit449087745b520c64113102f5c62bc5a8beba6c98 (patch)
tree1858aa8d17f250e516baedfaeed9c50e2614c531 /src
parenta0ca6026ad0ea049198e17dbda379d4737078053 (diff)
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)
Diffstat (limited to 'src')
-rw-r--r--src/cairo-font.c8
-rw-r--r--src/cairo-ft-font.c7
-rw-r--r--src/cairo-win32-font.c4
-rw-r--r--src/cairoint.h17
4 files changed, 21 insertions, 15 deletions
diff --git a/src/cairo-font.c b/src/cairo-font.c
index 9645f3df2..022be7da8 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -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 ();
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index afe80dffd..f6b0e9c08 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -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)
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 15dd96b3d..2867ab159 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -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;
}
diff --git a/src/cairoint.h b/src/cairoint.h
index 457478388..0e0cb7134 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -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