summaryrefslogtreecommitdiff
path: root/pango/pangocairo-font.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-04-30 23:09:47 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-04-30 23:09:47 +0000
commitbd7f0529df20a3268815da365944979af441cd3a (patch)
treefb8ed8d2a77ed919f180f7197f89695b6fd8af84 /pango/pangocairo-font.c
parent69bcc7f2e5ca2c7135e7ba558c85fffbce2426cb (diff)
downloadpango-bd7f0529df20a3268815da365944979af441cd3a.tar.gz
Move PANGO_UNITS_ROUND here... ...from here.
2007-04-30 Behdad Esfahbod <behdad@gnome.org> * pango/pango-types.h: Move PANGO_UNITS_ROUND here... * pango/pangofc-private.h: ...from here. * pango/pango-gravity.c: Document that pango_gravity_to_rotation() returns angle in radians but pango_matrix_rotate() takes degrees. * pango/pango-layout.c (pango_layout_run_get_extents): * pango/pango-renderer.c (pango_renderer_draw_layout_line): Retain metrics hinting when centering baseline (used for Latin, etc in vertical mode). * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_metrics), (pango_cairo_fc_font_glyph_extents_cache_init): Respect metrics hinting setting when moving glyphs around for vertical writing. * pango/pangocairo-fcfont.c (_pango_cairo_fc_font_new): Apply the gravity rotation before the pattern's matrix, such that vertical text gets correct italic direction. * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): Make hexbox font inherit most properties from the current font. That is, bold hexbox digits for a bold font, etc. svn path=/trunk/; revision=2238
Diffstat (limited to 'pango/pangocairo-font.c')
-rw-r--r--pango/pangocairo-font.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index d779b983..a8d011f2 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -142,10 +142,11 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont)
cairo_font_options_t *font_options;
cairo_font_extents_t font_extents;
double size, mini_size;
- PangoFontDescription *desc, *mini_desc;
+ PangoFontDescription *desc;
cairo_scaled_font_t *scaled_font, *scaled_mini_font;
PangoMatrix pango_ctm;
cairo_matrix_t cairo_ctm;
+ PangoGravity gravity;
if (!cfont)
return NULL;
@@ -164,8 +165,16 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont)
font_options = cairo_font_options_create ();
cairo_scaled_font_get_font_options (scaled_font, font_options);
is_hinted = (cairo_font_options_get_hint_metrics(font_options) != CAIRO_HINT_METRICS_OFF);
+ desc = pango_font_describe_with_absolute_size ((PangoFont *)cfont);
+ size = pango_font_description_get_size (desc) / (1.*PANGO_SCALE);
+ gravity = pango_font_description_get_gravity (desc);
cairo_scaled_font_get_ctm (scaled_font, &cairo_ctm);
+ /* I started adding support for vertical hexboxes here, but it's too much
+ * work. Easier to do with cairo user fonts and vertical writing mode
+ * support in cairo.
+ */
+ /*cairo_matrix_rotate (&cairo_ctm, pango_gravity_to_rotation (gravity));*/
pango_ctm.xx = cairo_ctm.xx;
pango_ctm.yx = cairo_ctm.yx;
pango_ctm.xy = cairo_ctm.xy;
@@ -201,12 +210,15 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont)
fontmap = pango_font_get_font_map ((PangoFont *)cfont);
- desc = pango_font_describe_with_absolute_size ((PangoFont *)cfont);
- size = pango_font_description_get_size (desc) / (1.*PANGO_SCALE);
+ /* we inherit most font properties for the mini font. just
+ * change family and size. means, you get bold hex digits
+ * in the hexbox for a bold font.
+ */
- mini_desc = pango_font_description_new ();
- pango_font_description_set_family_static (mini_desc, "monospace");
+ /* We should rotate the box, not glyphs */
+ pango_font_description_unset_fields (desc, PANGO_FONT_MASK_GRAVITY);
+ pango_font_description_set_family_static (desc, "monospace");
rows = 2;
mini_size = size / 2.4;
@@ -221,7 +233,7 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont)
}
}
- pango_font_description_set_absolute_size (mini_desc, mini_size * PANGO_SCALE);
+ pango_font_description_set_absolute_size (desc, mini_size * PANGO_SCALE);
/* load mini_font */
@@ -231,10 +243,8 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont)
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);
- pango_font_description_free (mini_desc);
+ mini_font = pango_font_map_load_font (fontmap, context, desc);
- pango_font_description_free (desc);
g_object_unref (context);
}