diff options
author | Behdad Esfahbod <behdad@src.gnome.org> | 2006-01-29 00:55:24 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-01-29 00:55:24 +0000 |
commit | 16272a0a5682514e3eda47cb53fa0708ec8f178c (patch) | |
tree | 1d16c73f1911730f59d5199dc3375d444cdd417e /pango/pango-layout.c | |
parent | 7b198ad324a75d8a910e7e75c1ac0e4c206af59d (diff) | |
download | pango-16272a0a5682514e3eda47cb53fa0708ec8f178c.tar.gz |
Reverted the tab alignments patch.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 5dc3a0ce..50143387 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -109,8 +109,6 @@ struct _PangoLayoutLinePrivate { PangoLayoutLine line; guint ref_count; - PangoGlyphString *last_tab_glyph; - PangoTabAlign last_tab_alignment; }; struct _PangoLayoutClass @@ -2497,8 +2495,11 @@ ensure_tab_width (PangoLayout *layout) } } +/* For now we only need the tab position, we assume + * all tabs are left-aligned. + */ static int -get_tab_pos (PangoLayout *layout, int index, PangoTabAlign *alignment) +get_tab_pos (PangoLayout *layout, int index) { gint n_tabs; gboolean in_pixels; @@ -2518,7 +2519,7 @@ get_tab_pos (PangoLayout *layout, int index, PangoTabAlign *alignment) { gint pos = 0; - pango_tab_array_get_tab (layout->tabs, index, alignment, &pos); + pango_tab_array_get_tab (layout->tabs, index, NULL, &pos); if (in_pixels) return pos * PANGO_SCALE; @@ -2535,10 +2536,10 @@ get_tab_pos (PangoLayout *layout, int index, PangoTabAlign *alignment) int next_to_last_pos = 0; int tab_width; - pango_tab_array_get_tab (layout->tabs, n_tabs - 1, alignment, &last_pos); + pango_tab_array_get_tab (layout->tabs, n_tabs - 1, NULL, &last_pos); if (n_tabs > 1) - pango_tab_array_get_tab (layout->tabs, n_tabs - 2, alignment, &next_to_last_pos); + pango_tab_array_get_tab (layout->tabs, n_tabs - 2, NULL, &next_to_last_pos); else next_to_last_pos = 0; @@ -2596,8 +2597,6 @@ shape_tab (PangoLayoutLine *line, { int i; - PangoTabAlign tab_alignment; - int current_width = line_width (line); pango_glyph_string_set_size (glyphs, 1); @@ -2611,16 +2610,13 @@ shape_tab (PangoLayoutLine *line, for (i=0;;i++) { - int tab_pos = get_tab_pos (line->layout, i, &tab_alignment); + int tab_pos = get_tab_pos (line->layout, i); if (tab_pos > current_width) { glyphs->glyphs[0].geometry.width = tab_pos - current_width; break; } } - PangoLayoutLinePrivate *private = (PangoLayoutLinePrivate *)line; - private->last_tab_glyph = glyphs; - private->last_tab_alignment = tab_alignment; } static inline gboolean @@ -2693,16 +2689,6 @@ struct _ParaBreakState * to the remaining portion of the first item */ }; -static int -glyphstring_width (PangoGlyphString* glyphs) -{ - int i; - int width = 0; - for (i=0; i < glyphs->num_glyphs; i++) - width += glyphs->glyphs[i].geometry.width; - return width; -} - static PangoGlyphString * shape_run (PangoLayoutLine *line, ParaBreakState *state, @@ -2715,10 +2701,6 @@ shape_run (PangoLayoutLine *line, shape_tab (line, glyphs); else { - PangoLayoutLinePrivate *private = (PangoLayoutLinePrivate *)line; - - g_return_val_if_fail (line != NULL, glyphs); - if (state->properties.shape_set) imposed_shape (layout->text + item->offset, item->num_chars, state->properties.shape_ink_rect, state->properties.shape_logical_rect, @@ -2726,21 +2708,6 @@ shape_run (PangoLayoutLine *line, else pango_shape (layout->text + item->offset, item->length, &item->analysis, glyphs); - if (private->last_tab_glyph != NULL) - { - if (private->last_tab_glyph->num_glyphs > 0) - { - int w = private->last_tab_glyph->glyphs[0].geometry.width; - if (private->last_tab_alignment == PANGO_TAB_RIGHT) - w -= glyphstring_width (glyphs); - else if (private->last_tab_alignment == PANGO_TAB_CENTER) - w -= glyphstring_width (glyphs) / 2; - - if (w < 0) w = 0; - private->last_tab_glyph->glyphs[0].geometry.width = w; - } - } - if (state->properties.letter_spacing) { PangoGlyphItem glyph_item; @@ -4067,8 +4034,6 @@ pango_layout_line_new (PangoLayout *layout) private->line.layout = layout; private->line.runs = 0; private->line.length = 0; - private->last_tab_glyph = NULL; - private->last_tab_alignment = PANGO_TAB_LEFT; /* Note that we leave start_index, resolved_dir, and is_paragraph_start * uninitialized */ |