From d12d6d920c636c8a6c45813427472a6da5ec3771 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 7 Jun 2006 07:37:07 +0000 Subject: Set matrix on the context we create to load minifont. 2006-06-07 Behdad Esfahbod * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): Set matrix on the context we create to load minifont. --- ChangeLog | 5 +++++ pango/pangocairo-font.c | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3b4e781..dd071462 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-07 Behdad Esfahbod + + * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): + Set matrix on the context we create to load minifont. + 2006-06-07 Behdad Esfahbod Bug 326960 – hex box drawing for win32 and atsui backends of cairo 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); -- cgit v1.2.1