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 int is_dummy() { return dummy; }
211 int is_composite() { return composite; }
212 void set_composite() { composite = 1; }
213 vunits get_vertical_spacing(); // .v
214 vunits get_post_vertical_spacing(); // .pvs
215 int get_line_spacing(); // .L
216 vunits total_post_vertical_spacing();
217 int get_point_size() { return size.to_scaled_points(); }
218 font_size get_font_size() { return size; }
219 int get_size() { return size.to_units(); }
220 int get_requested_point_size() { return requested_size; }
221 int get_char_height() { return char_height; }
222 int get_char_slant() { return char_slant; }
223 hunits get_digit_width();
224 int get_font() { return fontno; }; // .f
225 font_family *get_family() { return family; }
226 int get_bold(); // .b
227 int get_adjust_mode(); // .j
228 int get_fill(); // .u
229 hunits get_indent(); // .i
230 hunits get_temporary_indent();
231 hunits get_line_length(); // .l
232 hunits get_saved_line_length(); // .ll
233 hunits get_saved_indent(); // .in
234 hunits get_title_length();
235 hunits get_prev_char_width(); // .w
236 hunits get_prev_char_skew();
237 vunits get_prev_char_height();
238 vunits get_prev_char_depth();
239 hunits get_text_length(); // .k
240 hunits get_prev_text_length(); // .n
241 hunits get_space_width() { return env_space_width(this); }
242 int get_space_size() { return space_size; } // in ems/36
243 int get_sentence_space_size() { return sentence_space_size; }
244 hunits get_narrow_space_width() { return env_narrow_space_width(this); }
245 hunits get_half_narrow_space_width()
246 { return env_half_narrow_space_width(this); }
247 hunits get_input_line_position();
248 const char *get_tabs();
249 int get_hyphenation_flags();
250 int get_hyphen_line_max();
251 int get_hyphen_line_count();
252 hunits get_hyphenation_space();
253 hunits get_hyphenation_margin();
254 int get_center_lines();
255 int get_right_justify_lines();
256 int get_prev_line_interrupted() { return prev_line_interrupted; }
257 node *make_char_node(charinfo *);
258 node *extract_output_line();
259 void width_registers();
262 void set_font(symbol);
263 void set_family(symbol);
265 void set_char_height(int);
266 void set_char_slant(int);
267 void set_input_line_position(hunits); // used by \n(hp
269 void spread() { spread_flag = 1; }
270 void do_break(); // .br
273 void handle_tab(int is_leader = 0); // do a tab or leader
274 void add_node(node *);
275 void add_char(charinfo *);
276 void add_hyphen_indicator();
277 void add_italic_correction();
279 void space_newline();
280 const char *get_font_family_string();
281 const char *get_name_string();
282 const char *get_point_size_string();
283 const char *get_requested_point_size_string();
284 void output_pending_lines();
286 friend void title_length();
287 friend void space_size();
289 friend void no_fill();
290 friend void adjust();
291 friend void no_adjust();
292 friend void center();
293 friend void right_justify();
294 friend void vertical_spacing();
295 friend void post_vertical_spacing();
296 friend void line_spacing();
297 friend void line_length();
298 friend void indent();
299 friend void temporary_indent();
300 friend void underline();
301 friend void input_trap();
302 friend void set_tabs();
303 friend void margin_character();
304 friend void no_number();
305 friend void number_lines();
306 friend void leader_character();
307 friend void tab_character();
308 friend void hyphenate_request();
309 friend void no_hyphenate();
310 friend void hyphen_line_max_request();
311 friend void hyphenation_space_request();
312 friend void hyphenation_margin_request();
313 friend void line_width();
315 friend void tabs_save();
316 friend void tabs_restore();
320 friend void widow_control_request();
321 #endif /* WIDOW_CONTROL */
324 extern environment *curenv;
325 extern void pop_env();
326 extern void push_env(int);
328 void init_environments();
329 void read_hyphen_file(const char *name);
331 extern int break_flag;
332 extern symbol default_family;
333 extern int translate_space_to_dummy;