summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-09 19:37:29 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-12-09 19:37:29 +0000
commit2a3053e497d9396b525b88b78b413ebc484a6839 (patch)
treebb99d420b438d16a588923b9a8d96819302bffba
parentea2fa51616df5a23cd97f2cc8460a608722666c9 (diff)
parent3bb2249f3452061247655a11696a93dc5eeae584 (diff)
downloadpango-2a3053e497d9396b525b88b78b413ebc484a6839.tar.gz
Merge branch 'tab-assert-fix' into 'main'
layout: Handle a corner case Closes #638 See merge request GNOME/pango!539
-rw-r--r--pango/pango-layout.c4
-rw-r--r--tests/layouts/tab-assert.layout183
-rw-r--r--tests/meson.build1
3 files changed, 187 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index a495596c..a3f8b552 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4496,12 +4496,14 @@ process_line (PangoLayout *layout,
switch (result)
{
case BREAK_ALL_FIT:
- if (can_break_in (layout, state->start_offset, old_num_chars, first_item_in_line))
+ if (layout->text[item->offset] != '\t' &&
+ can_break_in (layout, state->start_offset, old_num_chars, first_item_in_line))
{
have_break = TRUE;
break_remaining_width = old_remaining_width;
break_start_offset = state->start_offset;
break_link = line->runs->next;
+ DEBUG1 ("all-fit, have break");
}
state->items = g_list_delete_link (state->items, state->items);
diff --git a/tests/layouts/tab-assert.layout b/tests/layouts/tab-assert.layout
new file mode 100644
index 00000000..0e3ebf25
--- /dev/null
+++ b/tests/layouts/tab-assert.layout
@@ -0,0 +1,183 @@
+{
+ "context" : {
+ "font" : "serif 12",
+ "base-gravity" : "south",
+ "gravity-hint" : "natural",
+ "base-dir" : "weak-ltr",
+ "round-glyph-positions" : true,
+ "transform" : [
+ 1,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0
+ ]
+ },
+ "comment" : "This layout was triggering an assertion in process_line",
+ "text" : " \t ",
+ "width" : 0,
+ "output" : {
+ "is-wrapped" : false,
+ "is-ellipsized" : false,
+ "unknown-glyphs" : 0,
+ "width" : 56320,
+ "height" : 56320,
+ "log-attrs" : [
+ {
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "sentence-boundary" : true,
+ "backspace-deletes-character" : true,
+ "expandable-space" : true,
+ "word-boundary" : true
+ },
+ {
+ "line-break" : true,
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "word-boundary" : true
+ },
+ {
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "backspace-deletes-character" : true,
+ "expandable-space" : true,
+ "word-boundary" : true
+ },
+ {
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "expandable-space" : true
+ },
+ {
+ "line-break" : true,
+ "mandatory-break" : true,
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "sentence-boundary" : true,
+ "word-boundary" : true
+ }
+ ],
+ "lines" : [
+ {
+ "start-index" : 0,
+ "length" : 4,
+ "paragraph-start" : true,
+ "direction" : "ltr",
+ "runs" : [
+ {
+ "offset" : 0,
+ "length" : 1,
+ "text" : " ",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "common",
+ "font" : {
+ "description" : "DejaVu Sans 12",
+ "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "matrix" : [
+ 1,
+ -0,
+ -0,
+ 1,
+ 0,
+ 0
+ ]
+ },
+ "flags" : 0,
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
+ {
+ "glyph" : 3,
+ "width" : 5120,
+ "is-cluster-start" : true,
+ "log-cluster" : 0
+ }
+ ]
+ },
+ {
+ "offset" : 1,
+ "length" : 1,
+ "text" : "\t",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "common",
+ "font" : {
+ "description" : "DejaVu Sans 12",
+ "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "matrix" : [
+ 1,
+ -0,
+ -0,
+ 1,
+ 0,
+ 0
+ ]
+ },
+ "flags" : 0,
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
+ {
+ "glyph" : 268435455,
+ "width" : 40960,
+ "is-cluster-start" : true,
+ "log-cluster" : 0
+ }
+ ]
+ },
+ {
+ "offset" : 2,
+ "length" : 2,
+ "text" : " ",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "common",
+ "font" : {
+ "description" : "DejaVu Sans 12",
+ "checksum" : "69ccd07023a72ceb27a5e5c22f728627353b60a198170f5e58dd7014221abf01",
+ "matrix" : [
+ 1,
+ -0,
+ -0,
+ 1,
+ 0,
+ 0
+ ]
+ },
+ "flags" : 0,
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
+ {
+ "glyph" : 3,
+ "width" : 5120,
+ "is-cluster-start" : true,
+ "log-cluster" : 0
+ },
+ {
+ "glyph" : 3,
+ "width" : 5120,
+ "is-cluster-start" : true,
+ "log-cluster" : 1
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index b15c7291..54592668 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -120,6 +120,7 @@ installed_test_layouts_data = [
'layouts/valid-21.layout',
'layouts/valid-22.layout',
'layouts/tab-crash.layout',
+ 'layouts/tab-assert.layout',
]
test_markups_data = [