diff options
author | Noah Levitt <nlevitt@columbia.edu> | 2003-12-04 23:11:28 +0000 |
---|---|---|
committer | Noah Levitt <nlevitt@src.gnome.org> | 2003-12-04 23:11:28 +0000 |
commit | 107ade7182f5a110b8717c2080c777c5c7c2cd44 (patch) | |
tree | 1fdf69352d72a50e71dcc80dc2f91264154ac50a /pango/pango-layout.c | |
parent | 3293fbd32eb9a024b05dee32dcaf1fc175546bc6 (diff) | |
download | pango-107ade7182f5a110b8717c2080c777c5c7c2cd44.tar.gz |
Honor U+2028 LINE SEPARATOR. (#85745)
2003-12-04 Noah Levitt <nlevitt@columbia.edu>
* pango/pango-context.c:
* pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 445caa1f..a4e532d1 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2472,7 +2472,8 @@ typedef enum BREAK_NONE_FIT, BREAK_SOME_FIT, BREAK_ALL_FIT, - BREAK_EMPTY_FIT + BREAK_EMPTY_FIT, + BREAK_LINE_SEPARATOR } BreakResult; typedef struct _ParaBreakState ParaBreakState; @@ -2561,6 +2562,10 @@ process_item (PangoLayout *layout, int i; gboolean processing_new_item = FALSE; + /* Only one character has type G_UNICODE_LINE_SEPARATOR in Unicode 4.0; + * update this if that changes. */ +#define LINE_SEPARATOR 0x2028 + if (!state->glyphs) { state->glyphs = pango_glyph_string_new (); @@ -2582,8 +2587,15 @@ process_item (PangoLayout *layout, processing_new_item = TRUE; } + + if (g_utf8_get_char (layout->text + item->offset) == LINE_SEPARATOR) + { + insert_run (line, state, layout->text, item, TRUE); + state->log_widths_offset += item->num_chars; + return BREAK_LINE_SEPARATOR; + } - if (state->remaining_width < 0 && !no_break_at_end) /* Wrapping off */ + if (state->remaining_width < 0 && !no_break_at_end) /* Wrapping off */ { insert_run (line, state, layout->text, item, TRUE); @@ -2735,7 +2747,7 @@ process_line (PangoLayout *layout, old_num_chars = item->num_chars; old_remaining_width = state->remaining_width; first_item_in_line = line->runs != NULL; - + result = process_item (layout, line, state, !have_break, FALSE); switch (result) @@ -2779,6 +2791,11 @@ process_line (PangoLayout *layout, state->start_offset += old_num_chars - item->num_chars; goto done; + + case BREAK_LINE_SEPARATOR: + state->items = g_list_delete_link (state->items, state->items); + state->start_offset += old_num_chars; + goto done; } } |