diff options
author | Noah Levitt <nlevitt@columbia.edu> | 2003-11-25 21:28:13 +0000 |
---|---|---|
committer | Noah Levitt <nlevitt@src.gnome.org> | 2003-11-25 21:28:13 +0000 |
commit | 3293fbd32eb9a024b05dee32dcaf1fc175546bc6 (patch) | |
tree | 77c10d8b21ebb32830cb49699c25218282c008ae /pango | |
parent | 6495fbc14fe9a55d540a21c578e7f067b2edbe6b (diff) | |
download | pango-3293fbd32eb9a024b05dee32dcaf1fc175546bc6.tar.gz |
Add --indent=n option.
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
* pango/pango-layout.[ch]: Indent the first line of every paragraph,
not just the first line in the layout. (#66626)
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-layout.c | 17 | ||||
-rw-r--r-- | pango/pango-layout.h | 1 |
2 files changed, 9 insertions, 9 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 0d5c501a..445caa1f 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -414,11 +414,10 @@ pango_layout_get_wrap (PangoLayout *layout) * @layout: a #PangoLayout. * @indent: the amount by which to indentset * - * Sets the amount by which the first line should be shorter than the - * rest of the lines. This may be negative, in which case - * the subsequent lines will be shorter than the first line. (However, - * in either case, the entire width of the layout will be given by - * the value.) + * Sets the width in pango units to indent each paragraph. A negative value + * of @indent will produce a hanging indent. That is, the first line will + * have the full width, and subsequent lines will be indented by the + * absolute value of @indent. **/ void pango_layout_set_indent (PangoLayout *layout, @@ -437,8 +436,8 @@ pango_layout_set_indent (PangoLayout *layout, * pango_layout_get_indent: * @layout: a #PangoLayout * - * Gets the amount by which the first line should be shorter than the - * rest of the lines. + * Gets the paragraph indent width in pango units. A negative value + * indicates a hanging indent. * * Return value: the indent **/ @@ -1808,9 +1807,8 @@ get_x_offset (PangoLayout *layout, if (layout->alignment == PANGO_ALIGN_CENTER) return; - if (line == layout->lines->data) + if (line->is_paragraph_start) { - /* First line */ if (layout->indent > 0) { if (layout->alignment == PANGO_ALIGN_LEFT) @@ -2719,6 +2717,7 @@ process_line (PangoLayout *layout, line = pango_layout_line_new (layout); line->start_index = state->line_start_index; + line->is_paragraph_start = state->first_line; if (state->first_line) state->remaining_width = (layout->indent >= 0) ? layout->width - layout->indent : layout->width; diff --git a/pango/pango-layout.h b/pango/pango-layout.h index f3c8dfce..b490cedd 100644 --- a/pango/pango-layout.h +++ b/pango/pango-layout.h @@ -54,6 +54,7 @@ struct _PangoLayoutLine gint start_index; /* start of line as byte index into layout->text */ gint length; /* length of line in bytes */ GSList *runs; + guint is_paragraph_start : 1; /* TRUE if this is the first line of the paragraph */ }; #define PANGO_TYPE_LAYOUT (pango_layout_get_type ()) |