Debian Codegraph @

texk/web2c/luatexdir/tex/linebreak.h

raw
1 /* linebreak.h
2
3 Copyright 2009 Taco Hoekwater <[email protected]>
4
5 This file is part of LuaTeX.
6
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.
11
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.
16
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/>. */
19
20 #ifndef LINEBREAK_H
21 # define LINEBREAK_H
22
23 extern halfword just_box; /* the |hlist_node| for the last line of the new paragraph */
24
25 extern void line_break(boolean d, int line_break_context);
26
27 # define inf_bad 10000 /* infinitely bad value */
28 # define awful_bad 07777777777 /* more than a billion demerits */
29
30 extern void initialize_active(void);
31
32 extern void ext_do_line_break(int paragraph_dir,
33 int pretolerance,
34 int tracing_paragraphs,
35 int tolerance,
36 scaled emergency_stretch,
37 int looseness,
38 /*
39 int hyphen_penalty,
40 int ex_hyphen_penalty,
41 */
42 int adjust_spacing,
43 halfword par_shape_ptr,
44 int adj_demerits,
45 int protrude_chars,
46 int line_penalty,
47 int last_line_fit,
48 int double_hyphen_demerits,
49 int final_hyphen_demerits,
50 int hang_indent,
51 int hsize,
52 int hang_after,
53 halfword left_skip,
54 halfword right_skip,
55 halfword inter_line_penalties_ptr,
56 int inter_line_penalty,
57 int club_penalty,
58 halfword club_penalties_ptr,
59 halfword widow_penalties_ptr,
60 int widow_penalty,
61 int broken_penalty, halfword final_par_glue);
62
63 extern void get_linebreak_info(int *, int *);
64 extern halfword find_protchar_left(halfword l, boolean d);
65 extern halfword find_protchar_right(halfword l, halfword r);
66
67 /* skipable nodes at the margins during character protrusion */
68
69 # define zero_dimensions(a) ( \
70 (width((a)) == 0) && \
71 (height((a)) == 0) && \
72 (depth((a)) == 0) \
73 )
74
75 # define empty_disc(a) ( \
76 (vlink_pre_break(a) == null) && \
77 (vlink_post_break(a) == null) && \
78 (vlink_no_break(a) == null) \
79 )
80
81 # define cp_skipable(a) ( (! is_char_node((a))) && ( \
82 ((type((a)) == glue_node) && (glue_is_zero((a)))) \
83 || (type((a)) == penalty_node) \
84 || ((type((a)) == disc_node) && empty_disc(a)) \
85 || ((type((a)) == kern_node) && ((width((a)) == 0) || (subtype((a)) == normal))) \
86 || ((type((a)) == rule_node) && zero_dimensions(a)) \
87 || ((type((a)) == math_node) && (surround((a)) == 0 || (glue_is_zero((a))))) \
88 || (type((a)) == dir_node) \
89 || ((type((a)) == hlist_node) && (list_ptr((a)) == null) && zero_dimensions(a)) \
90 || (type((a)) == local_par_node) \
91 || (type((a)) == ins_node) \
92 || (type((a)) == mark_node) \
93 || (type((a)) == adjust_node) \
94 || (type((a)) == boundary_node) \
95 || (type((a)) == whatsit_node) \
96 ) )
97
98 #endif