summaryrefslogtreecommitdiff
path: root/src/cairo-surface-wrapper.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-28 18:11:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-28 18:11:22 +0000
commitbe5ab6df68cba1bd0709fa4319e29141d4491d94 (patch)
treee7c6444aae55a04f7bf92dfa848cbf9283fe5994 /src/cairo-surface-wrapper.c
parent2c908f8a42456ab0ec6f12c36a2cf68523287ba7 (diff)
downloadcairo-be5ab6df68cba1bd0709fa4319e29141d4491d94.tar.gz
surface-wrapper: Apply the scaled-font ctm and non-default font-options
Improves record*-text-transform. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-surface-wrapper.c')
-rw-r--r--src/cairo-surface-wrapper.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cairo-surface-wrapper.c b/src/cairo-surface-wrapper.c
index b4dd64eb0..52d250c45 100644
--- a/src/cairo-surface-wrapper.c
+++ b/src/cairo-surface-wrapper.c
@@ -418,6 +418,7 @@ _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
cairo_glyph_t *dev_glyphs = stack_glyphs;
cairo_scaled_font_t *dev_scaled_font = scaled_font;
cairo_pattern_union_t source_copy;
+ cairo_font_options_t options;
if (unlikely (wrapper->target->status))
return wrapper->target->status;
@@ -426,6 +427,9 @@ _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
if (_cairo_clip_is_all_clipped (dev_clip))
return CAIRO_INT_STATUS_NOTHING_TO_DO;
+ cairo_surface_get_font_options (wrapper->target, &options);
+ cairo_font_options_merge (&options, &scaled_font->options);
+
if (wrapper->needs_transform) {
cairo_matrix_t m;
int i;
@@ -433,10 +437,13 @@ _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
_cairo_surface_wrapper_get_transform (wrapper, &m);
if (! _cairo_matrix_is_translation (&m)) {
+ cairo_matrix_t ctm;
+
+ _cairo_matrix_multiply (&ctm, &m, &scaled_font->ctm);
+
dev_scaled_font = cairo_scaled_font_create (scaled_font->font_face,
&scaled_font->font_matrix,
- &m,
- &scaled_font->options);
+ &ctm, &options);
}
if (num_glyphs > ARRAY_LENGTH (stack_glyphs)) {
@@ -460,6 +467,13 @@ _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
_copy_transformed_pattern (&source_copy.base, source, &m);
source = &source_copy.base;
} else {
+ if (! cairo_font_options_equal (&options, &scaled_font->options)) {
+ dev_scaled_font = cairo_scaled_font_create (scaled_font->font_face,
+ &scaled_font->font_matrix,
+ &scaled_font->ctm,
+ &options);
+ }
+
/* show_text_glyphs is special because _cairo_surface_show_text_glyphs is allowed
* to modify the glyph array that's passed in. We must always
* copy the array before handing it to the backend.