summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Levitt <nlevitt@columbia.edu>2003-12-04 23:11:28 +0000
committerNoah Levitt <nlevitt@src.gnome.org>2003-12-04 23:11:28 +0000
commit107ade7182f5a110b8717c2080c777c5c7c2cd44 (patch)
tree1fdf69352d72a50e71dcc80dc2f91264154ac50a
parent3293fbd32eb9a024b05dee32dcaf1fc175546bc6 (diff)
downloadpango-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)
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/pango-context.c12
-rw-r--r--pango/pango-layout.c23
7 files changed, 53 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1377d7a7..0c39a0da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-04 Noah Levitt <nlevitt@columbia.edu>
+
+ * pango/pango-context.c:
+ * pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
+
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 1377d7a7..0c39a0da 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+2003-12-04 Noah Levitt <nlevitt@columbia.edu>
+
+ * pango/pango-context.c:
+ * pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
+
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 1377d7a7..0c39a0da 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+2003-12-04 Noah Levitt <nlevitt@columbia.edu>
+
+ * pango/pango-context.c:
+ * pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
+
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 1377d7a7..0c39a0da 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+2003-12-04 Noah Levitt <nlevitt@columbia.edu>
+
+ * pango/pango-context.c:
+ * pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
+
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 1377d7a7..0c39a0da 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+2003-12-04 Noah Levitt <nlevitt@columbia.edu>
+
+ * pango/pango-context.c:
+ * pango/pango-layout.c: Honor U+2028 LINE SEPARATOR. (#85745)
+
2003-11-25 Noah Levitt <nlevitt@columbia.edu>
* examples/pangoft2topgm.c: Add --indent=n option.
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 50df5077..3bd7fd28 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -933,7 +933,11 @@ static void
itemize_state_process_run (ItemizeState *state)
{
const char *p;
- gboolean last_was_tab = FALSE;
+ gboolean last_was_forced_break = FALSE;
+
+ /* Only one character has type G_UNICODE_LINE_SEPARATOR in Unicode 4.0;
+ * update this if that changes. */
+#define LINE_SEPARATOR 0x2028
itemize_state_update_for_new_run (state);
@@ -942,7 +946,7 @@ itemize_state_process_run (ItemizeState *state)
p = g_utf8_next_char (p))
{
gunichar wc = g_utf8_get_char (p);
- gboolean is_tab = wc == '\t';
+ gboolean is_forced_break = (wc == '\t' || wc == LINE_SEPARATOR);
PangoEngineShape *shape_engine;
PangoFont *font;
@@ -956,10 +960,10 @@ itemize_state_process_run (ItemizeState *state)
itemize_state_add_character (state,
shape_engine, font,
- is_tab || last_was_tab,
+ is_forced_break || last_was_forced_break,
p);
- last_was_tab = is_tab;
+ last_was_forced_break = is_forced_break;
}
/* Finish the final item from the current segment */
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;
}
}