diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex/linebreak.w')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/tex/linebreak.w | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/linebreak.w b/Build/source/texk/web2c/luatexdir/tex/linebreak.w index 48705ad8cad..345a1a42456 100644 --- a/Build/source/texk/web2c/luatexdir/tex/linebreak.w +++ b/Build/source/texk/web2c/luatexdir/tex/linebreak.w @@ -755,6 +755,14 @@ Replacement texts and discretionary texts are supposed to contain only character nodes, kern nodes, and box or rule nodes. @c +#define bad_node_in_disc_error(p) { \ + if (type(p) == whatsit_node) { \ + formatted_error("linebreak","invalid node with type %s and subtype %i found in discretionary",node_data[type(p)].name,subtype(p)); \ + } else { \ + formatted_error("linebreak","invalid node with type %s found in discretionary",node_data[type(p)].name); \ + } \ +} + static void add_to_widths(halfword s, int line_break_dir, int adjust_spacing, scaled * widths) { while (s != null) { @@ -783,7 +791,8 @@ static void add_to_widths(halfword s, int line_break_dir, int adjust_spacing, sc case disc_node: /* TH temp */ break; default: - confusion("invalid node found in discretionary"); /* todo: report type */ + bad_node_in_disc_error(s); + break; } } s = vlink(s); @@ -825,7 +834,7 @@ static void sub_from_widths(halfword s, int line_break_dir, int adjust_spacing, case disc_node: /* TH temp */ break; default: - confusion("invalid node found in discretionary"); /* todo: report type */ + bad_node_in_disc_error(s); break; } } @@ -1857,20 +1866,16 @@ void ext_do_line_break(int paragraph_dir, to see whether or not a breakpoint is legal at |cur_p|, as explained above. - The |precedes_break| test also considers dir nodes and prohibits - a break after an opening dir_node (positive dir). In |\textdir TRT x| - the space after |TRT| is preserved and therefore the dir node - is bound to the |x|. Being more clever makes no sense: users - should code their input properly. + We only break after certain nodes (see texnodes.h), a font related + kern and a dir node when |\breakafterdirmode=1|. */ if (auto_breaking) { halfword prev_p = alink(cur_p); if (prev_p != temp_head && ( is_char_node(prev_p) || precedes_break(prev_p) - || ( (type(prev_p) == kern_node) && ( - subtype(prev_p) == font_kern || subtype(prev_p) == accent_kern) - ) + || precedes_kern(prev_p) + || precedes_dir(prev_p) )) { ext_try_break(0, unhyphenated_node, line_break_dir, adjust_spacing, par_shape_ptr, adj_demerits, |