1 /* linebreak.h
2 
3    Copyright 2009 Taco Hoekwater <taco@luatex.org>
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 
21 #ifndef LINEBREAK_H
22 #  define LINEBREAK_H
23 
24 #  define left_side 0
25 #  define right_side 1
26 
27 extern halfword just_box;       /* the |hlist_node| for the last line of the new paragraph */
28 
29 extern void line_break(boolean d, int line_break_context);
30 
31 #  define inf_bad 10000         /* infinitely bad value */
32 #  define awful_bad 07777777777 /* more than a billion demerits */
33 
34 extern void initialize_active(void);
35 
36 extern void ext_do_line_break(int paragraph_dir,
37                               int pretolerance,
38                               int tracing_paragraphs,
39                               int tolerance,
40                               scaled emergency_stretch,
41                               int looseness,
42                               int hyphen_penalty,
43                               int ex_hyphen_penalty,
44                               int pdf_adjust_spacing,
45                               halfword par_shape_ptr,
46                               int adj_demerits,
47                               int pdf_protrude_chars,
48                               int line_penalty,
49                               int last_line_fit,
50                               int double_hyphen_demerits,
51                               int final_hyphen_demerits,
52                               int hang_indent,
53                               int hsize,
54                               int hang_after,
55                               halfword left_skip,
56                               halfword right_skip,
57                               int pdf_each_line_height,
58                               int pdf_each_line_depth,
59                               int pdf_first_line_height,
60                               int pdf_last_line_depth,
61                               halfword inter_line_penalties_ptr,
62                               int inter_line_penalty,
63                               int club_penalty,
64                               halfword club_penalties_ptr,
65                               halfword widow_penalties_ptr,
66                               int widow_penalty,
67                               int broken_penalty, halfword final_par_glue,
68                               halfword pdf_ignored_dimen);
69 
70 extern void get_linebreak_info(int *, int *);
71 extern halfword find_protchar_left(halfword l, boolean d);
72 extern halfword find_protchar_right(halfword l, halfword r);
73 
74 /* skipable nodes at the margins during character protrusion */
75 
76 #  define cp_skipable(a) ((! is_char_node((a))) &&                        \
77                         ((type((a)) == ins_node)                        \
78                          || (type((a)) == mark_node)                    \
79                          || (type((a)) == adjust_node)                  \
80                          || (type((a)) == penalty_node)                 \
81                          || ((type((a)) == whatsit_node) &&             \
82                              (subtype((a)) != pdf_refximage_node) &&    \
83                              (subtype((a)) != pdf_refxform_node))       \
84                          /* reference to an image or XObject form */    \
85                          || ((type((a)) == disc_node) &&                \
86                              (vlink_pre_break(a) == null) &&            \
87                              (vlink_post_break(a) == null) &&           \
88                              (vlink_no_break(a) == null))               \
89                          /* an empty |disc_node| */                     \
90                          || ((type((a)) == math_node) &&                \
91                              (surround((a)) == 0))                      \
92                          || ((type((a)) == kern_node) &&                \
93                              ((width((a)) == 0) ||                      \
94                               (subtype((a)) == normal)))                \
95                          || ((type((a)) == glue_node) &&                \
96                              (glue_ptr((a)) == zero_glue))              \
97                          || ((type((a)) == hlist_node) &&               \
98                              (width((a)) == 0) &&                       \
99                              (height((a)) == 0) &&                      \
100                              (depth((a)) == 0) &&                       \
101                              (list_ptr((a)) == null))                   \
102                          ))
103 
104 
105 #endif
106