summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2001-12-06 19:51:49 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-12-06 19:51:49 +0000
commit187255e6344361251b61103f95a043ebd7fba772 (patch)
treef94f57211d2092235330f7325c86051057965fb8
parent5477b7d9187268389b28bb3df4eddeeba7360496 (diff)
downloadpango-187255e6344361251b61103f95a043ebd7fba772.tar.gz
hu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
* pango/break.c (pango_default_break): Simplify by being lazy and calling g_utf8_strlen() (causes a two passes over the array but shouldn't be a huge performance loss). Fix bug where attributes weren't set correctly for empty strings. Handle internal NULLs consistently with other functions (truncate) rather than dying with an assertion failure. (#65183)
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.pre-1-011
-rw-r--r--ChangeLog.pre-1-1011
-rw-r--r--ChangeLog.pre-1-211
-rw-r--r--ChangeLog.pre-1-411
-rw-r--r--ChangeLog.pre-1-611
-rw-r--r--ChangeLog.pre-1-811
-rw-r--r--pango/break.c46
8 files changed, 98 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index f59a945b..32a55b83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index f59a945b..32a55b83 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,13 @@
+Thu Dec 6 12:10:53 2001 Owen Taylor <otaylor@redhat.com>
+
+ * pango/break.c (pango_default_break): Simplify by
+ being lazy and calling g_utf8_strlen() (causes a
+ two passes over the array but shouldn't be a huge
+ performance loss). Fix bug where attributes weren't
+ set correctly for empty strings. Handle internal
+ NULLs consistently with other functions (truncate)
+ rather than dying with an assertion failure. (#65183)
+
Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* modules/basic/basic-x.c
@@ -29,6 +39,7 @@ Thu Dec 6 10:03:49 2001 HideToshi Tajima <hidetoshi.tajima@sun.com>
* pango/pango-fontset.c: Documentation updates.
+>>>>>>> 1.391
Thu Nov 29 11:40:51 2001 Owen Taylor <otaylor@redhat.com>
* examples/viewer-qt.cc: Include qpainter.h - apparently
diff --git a/pango/break.c b/pango/break.c
index dd979e5b..d49c242e 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -398,14 +398,12 @@ pango_default_break (const gchar *text,
*/
const gchar *next;
- const gchar *end;
- gint i = 0;
+ gint i;
gunichar prev_wc;
gunichar next_wc;
GUnicodeType prev_type;
GUnicodeBreakType prev_break_type; /* skips spaces */
gboolean prev_was_break_space;
- gboolean prev_was_end = FALSE;
WordType current_word_type = WordNone;
gunichar last_word_letter = 0;
SentenceState sentence_state = STATE_SENTENCE_OUTSIDE;
@@ -415,45 +413,45 @@ pango_default_break (const gchar *text,
gint possible_sentence_end = -1;
/* possible sentence break before Open* after a period-ended sentence */
gint possible_sentence_boundary = -1;
+ gint n_chars;
g_return_if_fail (text != NULL);
g_return_if_fail (attrs != NULL);
- if (length < 0)
- length = strlen (text);
-
+ n_chars = g_utf8_strlen (text, length);
+
next = text;
- end = text + length;
- if (next == end)
- return;
-
+ /* + 1 because of the extra newline we stick on the end */
+ if (attrs_len < n_chars + 1)
+ {
+ g_warning ("pango_default_break(): the array of PangoLogAttr passed in must have at least N+1 elements, if there are N characters in the text being broken");
+ return;
+ }
+
prev_type = (GUnicodeType) -1;
prev_break_type = G_UNICODE_BREAK_UNKNOWN;
prev_was_break_space = FALSE;
prev_wc = 0;
- next_wc = g_utf8_get_char (next);
-
- g_assert (next_wc != 0);
+ if (n_chars)
+ {
+ next_wc = g_utf8_get_char (next);
+ g_assert (next_wc != 0);
+ }
+ else
+ next_wc = '\n';
- while (next_wc != 0)
+ for (i = 0; i <= n_chars; i++)
{
GUnicodeType type;
gunichar wc;
GUnicodeBreakType break_type;
BreakOpportunity break_op;
- /* >, not >=, because of the extra newline we stick on the end */
- if (i > attrs_len)
- {
- g_warning ("pango_default_break(): the array of PangoLogAttr passed in must have at least N+1 elements, if there are N characters in the text being broken");
- return;
- }
-
wc = next_wc;
- if (prev_was_end)
+ if (i == n_chars)
{
/*
* If we have already reached the end of @text g_utf8_next_char()
@@ -465,13 +463,12 @@ pango_default_break (const gchar *text,
{
next = g_utf8_next_char (next);
- if (next == end)
+ if (i == n_chars - 1)
{
/* This is how we fill in the last element (end position) of the
* attr array - assume there's a newline off the end of @text.
*/
next_wc = '\n';
- prev_was_end = TRUE;
}
else
{
@@ -1280,7 +1277,6 @@ pango_default_break (const gchar *text,
prev_type = type;
prev_wc = wc;
- ++i;
}
}