summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-05-29 15:55:57 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-05-29 15:55:57 +0000
commitf138d945460f2c6e287e098d0bfe04ed20d57f18 (patch)
tree9a6ff9442643056cea66a11b21267aa5bcc8833e
parent45a1d90a3a453950f74bada5c5337554cb596062 (diff)
downloadpango-f138d945460f2c6e287e098d0bfe04ed20d57f18.tar.gz
Fix bug in MRU list code.
Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com> * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug in MRU list code. * pango/pango-layout.c (pango_layout_check_lines): Fix infinite loop in the case where the first item doesn't fit, but whitespace follows that must go onto the same line. * examples/viewer-qt.h: Minor changes so it compiles with Qt-2.0. (Though the utf8 codec in Qt-2.0 seems to be slightly buggy.)
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLog.pre-1-013
-rw-r--r--ChangeLog.pre-1-1013
-rw-r--r--ChangeLog.pre-1-213
-rw-r--r--ChangeLog.pre-1-413
-rw-r--r--ChangeLog.pre-1-613
-rw-r--r--ChangeLog.pre-1-813
-rw-r--r--examples/viewer-qt.cc2
-rw-r--r--pango/pango-layout.c41
-rw-r--r--pango/pangox-fontcache.c4
10 files changed, 119 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index d7217354..ab8bdddb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index d7217354..ab8bdddb 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,16 @@
+Mon May 29 11:14:34 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangox-fontcache.c (pango_x_font_cache_load): Fix bug
+ in MRU list code.
+
+ * pango/pango-layout.c (pango_layout_check_lines): Fix infinite
+ loop in the case where the first item doesn't fit, but
+ whitespace follows that must go onto the same line.
+
+ * examples/viewer-qt.h: Minor changes so it compiles with
+ qt-2.0. (Though the utf8 codec in qt-2.0 seems to be slightly
+ buggy.)
+
Sun May 28 16:24:43 2000 Owen Taylor <otaylor@redhat.com>
* examples/Makefile.am examples/viewer-qt.cc
diff --git a/examples/viewer-qt.cc b/examples/viewer-qt.cc
index c3d07040..b991a983 100644
--- a/examples/viewer-qt.cc
+++ b/examples/viewer-qt.cc
@@ -293,7 +293,7 @@ ViewerView::updateHighlightChar ()
{
QRect bounds = para->charBounds (highlight_index_);
bounds.moveBy (0, y);
- updateContents (bounds);
+ updateContents (bounds.x(), bounds.y(), bounds.width(), bounds.height());
break;
}
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index c0bcb43a..0953d9a3 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -1470,11 +1470,19 @@ shape_tab (PangoLayoutLine *line,
}
}
-static gboolean
+typedef enum
+{
+ BREAK_NONE_FIT,
+ BREAK_SOME_FIT,
+ BREAK_ALL_FIT,
+} BreakResult;
+
+static BreakResult
process_item (PangoLayoutLine *line,
PangoItem *item,
const char *text,
PangoLogAttr *log_attrs,
+ gboolean no_break_at_start,
gboolean no_break_at_end,
int *remaining_width)
{
@@ -1483,18 +1491,15 @@ process_item (PangoLayoutLine *line,
int length;
int i;
- if (*remaining_width == 0)
- return FALSE;
-
if (text[item->offset] == '\t')
shape_tab (line, glyphs);
else
pango_shape (text + item->offset, item->length, &item->analysis, glyphs);
- if (*remaining_width < 0)
+ if (*remaining_width < 0) /* Wrapping off */
{
insert_run (line, item, glyphs);
- return TRUE;
+ return BREAK_ALL_FIT;
}
width =0;
@@ -1506,7 +1511,7 @@ process_item (PangoLayoutLine *line,
*remaining_width -= width;
insert_run (line, item, glyphs);
- return TRUE;
+ return BREAK_ALL_FIT;
}
else
{
@@ -1544,21 +1549,21 @@ process_item (PangoLayoutLine *line,
*remaining_width -= width;
insert_run (line, new_item, glyphs);
- return FALSE;
+ return BREAK_SOME_FIT;
}
else
{
- if (!line->runs) /* Only item, insert it anyways */
+ if (no_break_at_start) /* We must insert something */
{
*remaining_width = 0;
insert_run (line, item, glyphs);
- return TRUE;
+ return BREAK_ALL_FIT;
}
else
{
pango_glyph_string_free (glyphs);
- return FALSE;
+ return BREAK_NONE_FIT;
}
}
}
@@ -1670,15 +1675,17 @@ pango_layout_check_lines (PangoLayout *layout)
while (tmp_list)
{
PangoItem *item = tmp_list->data;
- gboolean fits;
+ BreakResult result;
int old_num_chars = item->num_chars;
- fits = process_item (line, item, start,
- layout->log_attrs + start_offset, current_cant_end,
- &remaining_width);
+ result = process_item (line, item, start,
+ layout->log_attrs + start_offset,
+ (line->runs == NULL) || last_cant_end,
+ current_cant_end,
+ &remaining_width);
current_cant_end = FALSE;
- if (fits)
+ if (result == BREAK_ALL_FIT)
{
tmp_list = tmp_list->next;
start_offset += old_num_chars;
@@ -1705,7 +1712,7 @@ pango_layout_check_lines (PangoLayout *layout)
* we need to back up and break the last item.
*/
- if (last_cant_end && old_num_chars - item->num_chars == 0)
+ if (last_cant_end && result == BREAK_NONE_FIT)
{
GSList *tmp_node;
diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c
index b7d7a7fa..929d3302 100644
--- a/pango/pangox-fontcache.c
+++ b/pango/pangox-fontcache.c
@@ -211,8 +211,10 @@ pango_x_font_cache_load (PangoXFontCache *cache,
}
else
cache->mru_count++;
-
+
cache->mru = g_list_prepend (cache->mru, entry);
+ if (!cache->mru_tail)
+ cache->mru_tail = cache->mru;
entry->mru = cache->mru;
}