2 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff 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, or (at your option) any later
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 static size_range
*size_table
;
32 font_size(int points
);
34 int to_scaled_points();
36 int operator==(font_size
);
37 int operator!=(font_size
);
38 static void init_size_table(int *sizes
);
41 inline font_size::font_size() : p(0)
45 inline int font_size::operator==(font_size fs
)
50 inline int font_size::operator!=(font_size fs
)
55 inline int font_size::to_scaled_points()
60 inline int font_size::to_points()
67 hunits
env_digit_width(environment
*);
68 hunits
env_space_width(environment
*);
69 hunits
env_sentence_space_width(environment
*);
70 hunits
env_narrow_space_width(environment
*);
71 hunits
env_half_narrow_space_width(environment
*);
75 enum tab_type
{ TAB_NONE
, TAB_LEFT
, TAB_CENTER
, TAB_RIGHT
};
82 tab_stops(hunits distance
, tab_type type
);
83 tab_stops(const tab_stops
&);
85 void operator=(const tab_stops
&);
86 tab_type
distance_to_next_tab(hunits pos
, hunits
*distance
);
88 void add_tab(hunits pos
, tab_type type
, int repeated
);
89 const char *to_string();
92 const unsigned MARGIN_CHARACTER_ON
= 1;
93 const unsigned MARGIN_CHARACTER_NEXT
= 2;
99 struct pending_output_line
;
102 int dummy
; // dummy environment used for \w
103 hunits prev_line_length
;
105 hunits prev_title_length
;
110 int prev_requested_size
;
115 font_family
*prev_family
;
117 int space_size
; // in 36ths of an em
118 int sentence_space_size
; // same but for spaces at the end of sentences
122 int prev_line_interrupted
;
124 int right_justify_lines
;
125 vunits prev_vertical_spacing
;
126 vunits vertical_spacing
;
127 vunits prev_post_vertical_spacing
;
128 vunits post_vertical_spacing
;
129 int prev_line_spacing
;
133 hunits temporary_indent
;
134 int have_temporary_indent
;
136 hunits target_text_length
;
137 int pre_underline_fontno
;
140 int input_trap_count
;
141 node
*line
; // in reverse order
142 hunits prev_text_length
;
145 hunits input_line_start
;
150 tab_type current_tab
;
153 charinfo
*leader_char
;
154 int current_field
; // is there a current field?
155 hunits field_distance
;
156 hunits pre_field_width
;
158 int tab_field_spaces
;
159 int tab_precedes_field
;
161 int spread_flag
; // set by \p
162 unsigned margin_character_flags
;
163 node
*margin_character_node
;
164 hunits margin_character_distance
;
165 node
*numbering_nodes
;
166 hunits line_number_digit_width
;
167 int number_text_separation
; // in digit spaces
168 int line_number_indent
; // in digit spaces
169 int line_number_multiple
;
171 unsigned hyphenation_flags
;
172 int hyphen_line_count
;
174 hunits hyphenation_space
;
175 hunits hyphenation_margin
;
176 int composite
; // used for construction of composite char?
177 pending_output_line
*pending_lines
;
180 #endif /* WIDOW_CONTROL */
182 tab_type
distance_to_next_tab(hunits
*);
184 void output_line(node
*, hunits
);
185 void output(node
*nd
, int retain_size
, vunits vs
, vunits post_vs
,
187 void output_title(node
*nd
, int retain_size
, vunits vs
, vunits post_vs
,
190 void mark_last_line();
191 #endif /* WIDOW_CONTROL */
192 void possibly_break_line(int forced
= 0);
193 breakpoint
*choose_breakpoint();
194 void hyphenate_line();
196 void wrap_up_field();
198 node
*make_tab_node(hunits d
, node
*next
= 0);
199 node
*get_prev_char();
202 unsigned char control_char
;
203 unsigned char no_break_control_char
;
204 charinfo
*hyphen_indicator_char
;
207 environment(const environment
*); // for temporary environment
209 void copy(const environment
*);
210 int is_dummy() { return dummy
; }
212 int is_composite() { return composite
; }
213 void set_composite() { composite
= 1; }
214 vunits
get_vertical_spacing(); // .v
215 vunits
get_post_vertical_spacing(); // .pvs
216 int get_line_spacing(); // .L
217 vunits
total_post_vertical_spacing();
218 int get_point_size() { return size
.to_scaled_points(); }
219 font_size
get_font_size() { return size
; }
220 int get_size() { return size
.to_units(); }
221 int get_requested_point_size() { return requested_size
; }
222 int get_char_height() { return char_height
; }
223 int get_char_slant() { return char_slant
; }
224 hunits
get_digit_width();
225 int get_font() { return fontno
; }; // .f
226 font_family
*get_family() { return family
; }
227 int get_bold(); // .b
228 int get_adjust_mode(); // .j
229 int get_fill(); // .u
230 hunits
get_indent(); // .i
231 hunits
get_temporary_indent();
232 hunits
get_line_length(); // .l
233 hunits
get_saved_line_length(); // .ll
234 hunits
get_saved_indent(); // .in
235 hunits
get_title_length();
236 hunits
get_prev_char_width(); // .w
237 hunits
get_prev_char_skew();
238 vunits
get_prev_char_height();
239 vunits
get_prev_char_depth();
240 hunits
get_text_length(); // .k
241 hunits
get_prev_text_length(); // .n
242 hunits
get_space_width() { return env_space_width(this); }
243 int get_space_size() { return space_size
; } // in ems/36
244 int get_sentence_space_size() { return sentence_space_size
; }
245 hunits
get_narrow_space_width() { return env_narrow_space_width(this); }
246 hunits
get_half_narrow_space_width()
247 { return env_half_narrow_space_width(this); }
248 hunits
get_input_line_position();
249 const char *get_tabs();
250 int get_hyphenation_flags();
251 int get_hyphen_line_max();
252 int get_hyphen_line_count();
253 hunits
get_hyphenation_space();
254 hunits
get_hyphenation_margin();
255 int get_center_lines();
256 int get_right_justify_lines();
257 int get_prev_line_interrupted() { return prev_line_interrupted
; }
258 node
*make_char_node(charinfo
*);
259 node
*extract_output_line();
260 void width_registers();
263 void set_font(symbol
);
264 void set_family(symbol
);
266 void set_char_height(int);
267 void set_char_slant(int);
268 void set_input_line_position(hunits
); // used by \n(hp
270 void spread() { spread_flag
= 1; }
271 void do_break(); // .br
273 void add_html_tag (const char *name
);
275 void handle_tab(int is_leader
= 0); // do a tab or leader
276 void add_node(node
*);
277 void add_char(charinfo
*);
278 void add_hyphen_indicator();
279 void add_italic_correction();
281 void space_newline();
282 const char *get_font_family_string();
283 const char *get_name_string();
284 const char *get_point_size_string();
285 const char *get_requested_point_size_string();
286 void output_pending_lines();
288 friend void title_length();
289 friend void space_size();
291 friend void no_fill();
292 friend void adjust();
293 friend void no_adjust();
294 friend void center();
295 friend void right_justify();
296 friend void vertical_spacing();
297 friend void post_vertical_spacing();
298 friend void line_spacing();
299 friend void line_length();
300 friend void indent();
301 friend void temporary_indent();
302 friend void underline();
303 friend void input_trap();
304 friend void set_tabs();
305 friend void margin_character();
306 friend void no_number();
307 friend void number_lines();
308 friend void leader_character();
309 friend void tab_character();
310 friend void hyphenate_request();
311 friend void no_hyphenate();
312 friend void hyphen_line_max_request();
313 friend void hyphenation_space_request();
314 friend void hyphenation_margin_request();
315 friend void line_width();
317 friend void tabs_save();
318 friend void tabs_restore();
322 friend void widow_control_request();
323 #endif /* WIDOW_CONTROL */
326 extern environment
*curenv
;
327 extern void pop_env();
328 extern void push_env(int);
330 void init_environments();
331 void read_hyphen_file(const char *name
);
333 extern int break_flag
;
334 extern symbol default_family
;
335 extern int translate_space_to_dummy
;