beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / tex / linebreak.h
blob1b5d1da96cacafe76b955f4e4b00e95ebfa60c10
1 /* linebreak.h
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/>. */
20 #ifndef LINEBREAK_H
21 # define LINEBREAK_H
23 # define left_side 0
24 # define right_side 1
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,
36 int pretolerance,
37 int tracing_paragraphs,
38 int tolerance,
39 scaled emergency_stretch,
40 int looseness,
42 int hyphen_penalty,
43 int ex_hyphen_penalty,
45 int adjust_spacing,
46 halfword par_shape_ptr,
47 int adj_demerits,
48 int protrude_chars,
49 int line_penalty,
50 int last_line_fit,
51 int double_hyphen_demerits,
52 int final_hyphen_demerits,
53 int hang_indent,
54 int hsize,
55 int hang_after,
56 halfword left_skip,
57 halfword right_skip,
58 halfword inter_line_penalties_ptr,
59 int inter_line_penalty,
60 int club_penalty,
61 halfword club_penalties_ptr,
62 halfword widow_penalties_ptr,
63 int widow_penalty,
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) && \
75 (depth((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_ptr((a)) == zero_glue)) \
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)) \
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) \
99 ) )
101 #endif