diff options
author | Havoc Pennington <hp@redhat.com> | 2000-11-15 00:15:28 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-11-15 00:15:28 +0000 |
commit | 834a0b94d90aced253960a85c85a9a2beeabfda7 (patch) | |
tree | ad5ca3da7a24ede2e5386a45c907d31e316fb26f /pango | |
parent | 30bee05412da1fcf54c11029b2eb00969fd9d7c1 (diff) | |
download | pango-834a0b94d90aced253960a85c85a9a2beeabfda7.tar.gz |
get the value of any rise attribute (pango_layout_run_get_extents): take
2000-11-14 Havoc Pennington <hp@redhat.com>
* pango/pango-layout.c (pango_layout_get_item_properties): get the
value of any rise attribute
(pango_layout_run_get_extents): take rise into account
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-layout.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 7f767f83..853ebf8c 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -139,6 +139,7 @@ static int *pango_layout_line_get_vis2log_map (PangoLayoutLine *line, static void pango_layout_get_item_properties (PangoItem *item, PangoUnderline *uline, + gint *rise, PangoRectangle *ink_rect, PangoRectangle *logical_rect, gboolean *shape_set); @@ -852,7 +853,8 @@ pango_layout_line_index_to_x (PangoLayoutLine *line, PangoLayoutRun *run = run_list->data; gboolean shape_set; - pango_layout_get_item_properties (run->item, NULL, NULL, &logical_rect, &shape_set); + pango_layout_get_item_properties (run->item, NULL, NULL, NULL, + &logical_rect, &shape_set); if (run->item->offset <= index && run->item->offset + run->item->length > index) { @@ -2112,7 +2114,8 @@ process_item (PangoLayoutLine *line, int length; int i; - pango_layout_get_item_properties (item, NULL, &shape_ink, &shape_logical, &shape_set); + pango_layout_get_item_properties (item, NULL, NULL, + &shape_ink, &shape_logical, &shape_set); if (shape_set) imposed_shape (item->num_chars, &shape_ink, &shape_logical, glyphs); @@ -2573,7 +2576,8 @@ pango_layout_line_x_to_index (PangoLayoutLine *line, PangoLayoutRun *run = tmp_list->data; gboolean shape_set; - pango_layout_get_item_properties (run->item, NULL, NULL, &logical_rect, &shape_set); + pango_layout_get_item_properties (run->item, NULL, NULL, + NULL, &logical_rect, &shape_set); if (!shape_set) pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &logical_rect); @@ -2865,14 +2869,14 @@ pango_layout_run_get_extents (PangoLayoutRun *run, PangoRectangle *run_logical) { PangoUnderline uline = PANGO_UNDERLINE_NONE; - + int rise = 0; PangoRectangle shape_ink; PangoRectangle shape_logical; PangoRectangle tmp_ink; gboolean shape_set; gboolean need_ink; - pango_layout_get_item_properties (run->item, &uline, + pango_layout_get_item_properties (run->item, &uline, &rise, &shape_ink, &shape_logical, &shape_set); if (shape_setp) @@ -2914,6 +2918,14 @@ pango_layout_run_get_extents (PangoLayoutRun *run, tmp_ink.y + tmp_ink.height + 2 * PANGO_SCALE - run_logical->y); break; } + + if (rise != 0) + { + if (run_ink) + run_ink->y -= rise; + + run_logical->y -= rise; + } } /** @@ -3159,6 +3171,7 @@ pango_layout_line_postprocess (PangoLayoutLine *line) static void pango_layout_get_item_properties (PangoItem *item, PangoUnderline *uline, + gint *rise, PangoRectangle *ink_rect, PangoRectangle *logical_rect, gboolean *shape_set) @@ -3167,7 +3180,13 @@ pango_layout_get_item_properties (PangoItem *item, if (shape_set) *shape_set = FALSE; - + + if (rise) + *rise = 0; + + if (uline) + *uline = PANGO_UNDERLINE_NONE; + while (tmp_list) { PangoAttribute *attr = tmp_list->data; @@ -3178,7 +3197,12 @@ pango_layout_get_item_properties (PangoItem *item, if (uline) *uline = ((PangoAttrInt *)attr)->value; break; - + + case PANGO_ATTR_RISE: + if (rise) + *rise = ((PangoAttrInt *)attr)->value; + break; + case PANGO_ATTR_SHAPE: if (shape_set) *shape_set = TRUE; |