diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-06-07 07:37:07 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-06-07 07:37:07 +0000 |
commit | d12d6d920c636c8a6c45813427472a6da5ec3771 (patch) | |
tree | 10ef4e50c0fff4edd3c26d512ce84c32ceab5fdb /pango/pangocairo-font.c | |
parent | 6fb881a2d90dfd1254745f2ac8d43bd36b1720d1 (diff) | |
download | pango-d12d6d920c636c8a6c45813427472a6da5ec3771.tar.gz |
Set matrix on the context we create to load minifont.
2006-06-07 Behdad Esfahbod <behdad@gnome.org>
* pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info):
Set matrix on the context we create to load minifont.
Diffstat (limited to 'pango/pangocairo-font.c')
-rw-r--r-- | pango/pangocairo-font.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 6477229b..cfa55d42 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -135,6 +135,8 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) double size, mini_size; PangoFontDescription *desc, *mini_desc; cairo_scaled_font_t *scaled_font, *scaled_mini_font; + PangoMatrix pango_ctm; + cairo_matrix_t cairo_ctm; if (!cfont) return NULL; @@ -154,20 +156,26 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) cairo_scaled_font_get_font_options (scaled_font, font_options); is_hinted = (cairo_font_options_get_hint_metrics(font_options) != CAIRO_HINT_METRICS_OFF); + cairo_scaled_font_get_ctm (scaled_font, &cairo_ctm); + pango_ctm.xx = cairo_ctm.xx; + pango_ctm.yx = cairo_ctm.yx; + pango_ctm.xy = cairo_ctm.xy; + pango_ctm.yy = cairo_ctm.yy; + pango_ctm.x0 = cairo_ctm.x0; + pango_ctm.y0 = cairo_ctm.y0; + if (is_hinted) { /* prepare for some hinting */ - cairo_matrix_t ctm; double x, y; - cairo_scaled_font_get_ctm (scaled_font, &ctm); x = 1.; y = 0.; - cairo_matrix_transform_distance (&ctm, &x, &y); + cairo_matrix_transform_distance (&cairo_ctm, &x, &y); scale_x = sqrt (x*x + y*y); scale_x_inv = 1 / scale_x; x = 0.; y = 1.; - cairo_matrix_transform_distance (&ctm, &x, &y); + cairo_matrix_transform_distance (&cairo_ctm, &x, &y); scale_y = sqrt (x*x + y*y); scale_y_inv = 1 / scale_y; } @@ -211,6 +219,7 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + pango_context_set_matrix (context, &pango_ctm); pango_context_set_language (context, pango_language_from_string ("en")); pango_cairo_context_set_font_options (context, font_options); mini_font = pango_font_map_load_font (fontmap, context, mini_desc); |