3 Copyright 2009 Taco Hoekwater <taco@luatex.org>
5 This file is part of LuaTeX.
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
26 extern halfword just_box
; /* the |hlist_node| for the last line of the new paragraph */
28 extern void line_break(boolean d
, int line_break_context
);
30 # define inf_bad 10000 /* infinitely bad value */
31 # define awful_bad 07777777777 /* more than a billion demerits */
33 extern void initialize_active(void);
35 extern void ext_do_line_break(int paragraph_dir
,
37 int tracing_paragraphs
,
39 scaled emergency_stretch
,
43 int ex_hyphen_penalty,
46 halfword par_shape_ptr
,
51 int double_hyphen_demerits
,
52 int final_hyphen_demerits
,
58 halfword inter_line_penalties_ptr
,
59 int inter_line_penalty
,
61 halfword club_penalties_ptr
,
62 halfword widow_penalties_ptr
,
64 int broken_penalty
, halfword final_par_glue
);
66 extern void get_linebreak_info(int *, int *);
67 extern halfword
find_protchar_left(halfword l
, boolean d
);
68 extern halfword
find_protchar_right(halfword l
, halfword r
);
70 /* skipable nodes at the margins during character protrusion */
72 # define zero_dimensions(a) ( \
73 (width((a)) == 0) && \
74 (height((a)) == 0) && \
78 # define empty_disc(a) ( \
79 (vlink_pre_break(a) == null) && \
80 (vlink_post_break(a) == null) && \
81 (vlink_no_break(a) == null) \
84 # define cp_skipable(a) ( (! is_char_node((a))) && ( \
85 ((type((a)) == glue_node) && (glue_is_zero((a)))) \
86 || (type((a)) == penalty_node) \
87 || ((type((a)) == disc_node) && empty_disc(a)) \
88 || ((type((a)) == kern_node) && ((width((a)) == 0) || (subtype((a)) == normal))) \
89 || ((type((a)) == rule_node) && zero_dimensions(a)) \
90 || ((type((a)) == math_node) && (surround((a)) == 0 || (glue_is_zero((a))))) \
91 || (type((a)) == dir_node) \
92 || ((type((a)) == hlist_node) && (list_ptr((a)) == null) && zero_dimensions(a)) \
93 || (type((a)) == local_par_node) \
94 || (type((a)) == ins_node) \
95 || (type((a)) == mark_node) \
96 || (type((a)) == adjust_node) \
97 || (type((a)) == boundary_node) \
98 || (type((a)) == whatsit_node) \