summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-11-16 00:09:29 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-11-16 00:09:29 +0000
commit399c0a006cc8f9d8005c562a7e90cbfef95e2a18 (patch)
tree5c2478d9a7e1bcde80e4a65c1d6a558dba8f1025
parent8797f632c8f9f91eb26573e86accd9fcc1ad6322 (diff)
downloadpango-399c0a006cc8f9d8005c562a7e90cbfef95e2a18.tar.gz
Fix problem with unbreakable words at start of line longer than line
Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com> * pango/pango-layout.c (process_item): Fix problem with unbreakable words at start of line longer than line width.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-05
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-25
-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-layout.c67
8 files changed, 72 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 03f8fcef..6e0275d7 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+Wed Nov 15 16:56:38 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-layout.c (process_item): Fix problem with
+ unbreakable words at start of line longer than line width.
+
Wed Nov 15 15:04:00 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_extents_internal):
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9b0d844e..1bf2d69e 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2200,6 +2200,8 @@ process_item (PangoLayout *layout,
else
{
int num_chars = item->num_chars;
+ int break_num_chars = num_chars;
+ int break_width = width;
PangoGlyphUnit *log_widths = g_new (PangoGlyphUnit, item->num_chars);
pango_glyph_string_get_logical_widths (glyphs, text + item->offset, item->length, item->analysis.level, log_widths);
@@ -2209,51 +2211,56 @@ process_item (PangoLayout *layout,
{
width -= log_widths[num_chars];
- if (can_break_at (layout, start_offset + num_chars) &&
- width <= *remaining_width)
- break;
+ if (can_break_at (layout, start_offset + num_chars))
+ {
+ break_num_chars = num_chars;
+ break_width = width;
+
+ if (width <= *remaining_width)
+ break;
+ }
}
g_free (log_widths);
- if (num_chars > 0) /* Succesfully broke the item */
+ if (no_break_at_start || break_width <= *remaining_width) /* Succesfully broke the item */
{
- PangoItem *new_item = pango_item_copy (item);
-
- length = g_utf8_offset_to_pointer (text + item->offset, num_chars) - (text + item->offset);
-
- new_item->length = length;
- new_item->num_chars = num_chars;
+ *remaining_width -= break_width;
- item->offset += length;
- item->length -= length;
- item->num_chars -= num_chars;
-
- if (shape_set)
- imposed_shape (item->num_chars, &shape_ink, &shape_logical, glyphs);
- else
- pango_shape (text + new_item->offset, new_item->length, &new_item->analysis, glyphs);
-
- *remaining_width -= width;
- insert_run (line, new_item, glyphs);
-
- return BREAK_SOME_FIT;
- }
- else
- {
- if (no_break_at_start) /* We must insert something */
+ if (break_num_chars == item->num_chars)
{
- *remaining_width = 0;
insert_run (line, item, glyphs);
return BREAK_ALL_FIT;
}
else
{
- pango_glyph_string_free (glyphs);
- return BREAK_NONE_FIT;
+ PangoItem *new_item = pango_item_copy (item);
+
+ length = g_utf8_offset_to_pointer (text + item->offset, break_num_chars) - (text + item->offset);
+
+ new_item->length = length;
+ new_item->num_chars = break_num_chars;
+
+ item->offset += length;
+ item->length -= length;
+ item->num_chars -= break_num_chars;
+
+ if (shape_set)
+ imposed_shape (item->num_chars, &shape_ink, &shape_logical, glyphs);
+ else
+ pango_shape (text + new_item->offset, new_item->length, &new_item->analysis, glyphs);
+
+ insert_run (line, new_item, glyphs);
+
+ return BREAK_SOME_FIT;
}
}
+ else
+ {
+ pango_glyph_string_free (glyphs);
+ return BREAK_NONE_FIT;
+ }
}
}