2 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Written by James Clark (jjc@jclark.com)
6 This file is part of groff.
8 groff is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with groff; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 static size_range
*size_table
;
33 font_size(int points
);
35 int to_scaled_points();
37 int operator==(font_size
);
38 int operator!=(font_size
);
39 static void init_size_table(int *sizes
);
42 inline font_size::font_size() : p(0)
46 inline int font_size::operator==(font_size fs
)
51 inline int font_size::operator!=(font_size fs
)
56 inline int font_size::to_scaled_points()
61 inline int font_size::to_points()
68 hunits
env_digit_width(environment
*);
69 hunits
env_space_width(environment
*);
70 hunits
env_sentence_space_width(environment
*);
71 hunits
env_narrow_space_width(environment
*);
72 hunits
env_half_narrow_space_width(environment
*);
76 enum tab_type
{ TAB_NONE
, TAB_LEFT
, TAB_CENTER
, TAB_RIGHT
};
83 tab_stops(hunits distance
, tab_type type
);
84 tab_stops(const tab_stops
&);
86 void operator=(const tab_stops
&);
87 tab_type
distance_to_next_tab(hunits pos
, hunits
*distance
);
88 tab_type
distance_to_next_tab(hunits curpos
, hunits
*distance
, hunits
*leftpos
);
90 void add_tab(hunits pos
, tab_type type
, int repeated
);
91 const char *to_string();
94 const unsigned MARGIN_CHARACTER_ON
= 1;
95 const unsigned MARGIN_CHARACTER_NEXT
= 2;
101 struct pending_output_line
;
104 int dummy
; // dummy environment used for \w
105 hunits prev_line_length
;
107 hunits prev_title_length
;
112 int prev_requested_size
;
117 font_family
*prev_family
;
119 int space_size
; // in 36ths of an em
120 int sentence_space_size
; // same but for spaces at the end of sentences
124 int prev_line_interrupted
;
126 int right_justify_lines
;
127 vunits prev_vertical_spacing
;
128 vunits vertical_spacing
;
129 vunits prev_post_vertical_spacing
;
130 vunits post_vertical_spacing
;
131 int prev_line_spacing
;
135 hunits temporary_indent
;
136 int have_temporary_indent
;
138 hunits target_text_length
;
139 int pre_underline_fontno
;
141 int underline_spaces
;
143 int input_trap_count
;
144 int continued_input_trap
;
145 node
*line
; // in reverse order
146 hunits prev_text_length
;
149 hunits input_line_start
;
155 tab_type current_tab
;
158 charinfo
*leader_char
;
159 int current_field
; // is there a current field?
160 hunits field_distance
;
161 hunits pre_field_width
;
163 int tab_field_spaces
;
164 int tab_precedes_field
;
166 int spread_flag
; // set by \p
167 unsigned margin_character_flags
;
168 node
*margin_character_node
;
169 hunits margin_character_distance
;
170 node
*numbering_nodes
;
171 hunits line_number_digit_width
;
172 int number_text_separation
; // in digit spaces
173 int line_number_indent
; // in digit spaces
174 int line_number_multiple
;
176 unsigned hyphenation_flags
;
177 int hyphen_line_count
;
179 hunits hyphenation_space
;
180 hunits hyphenation_margin
;
181 int composite
; // used for construction of composite char?
182 pending_output_line
*pending_lines
;
185 #endif /* WIDOW_CONTROL */
187 int emitted_node
; // have we emitted a node since the last html eol tag?
188 color
*cur_glyph_color
;
189 color
*prev_glyph_color
;
190 color
*cur_fill_color
;
191 color
*prev_fill_color
;
193 tab_type
distance_to_next_tab(hunits
*);
194 tab_type
distance_to_next_tab(hunits
*distance
, hunits
*leftpos
);
196 void output_line(node
*, hunits
);
197 void output(node
*nd
, int retain_size
, vunits vs
, vunits post_vs
,
199 void output_title(node
*nd
, int retain_size
, vunits vs
, vunits post_vs
,
202 void mark_last_line();
203 #endif /* WIDOW_CONTROL */
204 breakpoint
*choose_breakpoint();
205 void hyphenate_line(int start_here
= 0);
207 void wrap_up_field();
209 node
*make_tab_node(hunits d
, node
*next
= 0);
210 node
*get_prev_char();
213 unsigned char control_char
;
214 unsigned char no_break_control_char
;
215 charinfo
*hyphen_indicator_char
;
218 environment(const environment
*); // for temporary environment
220 void copy(const environment
*);
221 int is_dummy() { return dummy
; }
223 int is_composite() { return composite
; }
224 void set_composite() { composite
= 1; }
225 vunits
get_vertical_spacing(); // .v
226 vunits
get_post_vertical_spacing(); // .pvs
227 int get_line_spacing(); // .L
228 vunits
total_post_vertical_spacing();
229 int get_point_size() { return size
.to_scaled_points(); }
230 font_size
get_font_size() { return size
; }
231 int get_size() { return size
.to_units(); }
232 int get_requested_point_size() { return requested_size
; }
233 int get_char_height() { return char_height
; }
234 int get_char_slant() { return char_slant
; }
235 hunits
get_digit_width();
236 int get_font() { return fontno
; }; // .f
237 font_family
*get_family() { return family
; }
238 int get_bold(); // .b
239 int get_adjust_mode(); // .j
240 int get_fill(); // .u
241 hunits
get_indent(); // .i
242 hunits
get_temporary_indent();
243 hunits
get_line_length(); // .l
244 hunits
get_saved_line_length(); // .ll
245 hunits
get_saved_indent(); // .in
246 hunits
get_title_length();
247 hunits
get_prev_char_width(); // .w
248 hunits
get_prev_char_skew();
249 vunits
get_prev_char_height();
250 vunits
get_prev_char_depth();
251 hunits
get_text_length(); // .k
252 hunits
get_prev_text_length(); // .n
253 hunits
get_space_width() { return env_space_width(this); }
254 int get_space_size() { return space_size
; } // in ems/36
255 int get_sentence_space_size() { return sentence_space_size
; }
256 hunits
get_narrow_space_width() { return env_narrow_space_width(this); }
257 hunits
get_half_narrow_space_width()
258 { return env_half_narrow_space_width(this); }
259 hunits
get_input_line_position();
260 const char *get_tabs();
262 int get_hyphenation_flags();
263 int get_hyphen_line_max();
264 int get_hyphen_line_count();
265 hunits
get_hyphenation_space();
266 hunits
get_hyphenation_margin();
267 int get_center_lines();
268 int get_right_justify_lines();
269 int get_prev_line_interrupted() { return prev_line_interrupted
; }
270 color
*get_fill_color();
271 color
*get_glyph_color();
272 color
*get_prev_glyph_color();
273 color
*get_prev_fill_color();
274 void set_glyph_color(color
*c
);
275 void set_fill_color(color
*c
);
276 node
*make_char_node(charinfo
*);
277 node
*extract_output_line();
278 void width_registers();
281 void set_font(symbol
);
282 void set_family(symbol
);
284 void set_char_height(int);
285 void set_char_slant(int);
286 void set_input_line_position(hunits
); // used by \n(hp
288 void spread() { spread_flag
= 1; }
289 void possibly_break_line(int start_here
= 0, int forced
= 0);
290 void do_break(int spread
= 0); // .br
292 void add_html_tag(int, const char *);
293 void add_html_tag(int, const char *, int);
294 void add_html_tag_tabs(int);
295 node
*make_html_tag(const char *name
, int i
);
296 node
*make_html_tag(const char *);
298 void handle_tab(int is_leader
= 0); // do a tab or leader
299 void add_node(node
*);
300 void add_char(charinfo
*);
301 void add_hyphen_indicator();
302 void add_italic_correction();
304 void space(hunits
, hunits
);
305 void space_newline();
306 const char *get_font_family_string();
307 const char *get_font_name_string();
308 const char *get_name_string();
309 const char *get_point_size_string();
310 const char *get_requested_point_size_string();
311 void output_pending_lines();
313 friend void title_length();
314 friend void space_size();
316 friend void no_fill();
317 friend void adjust();
318 friend void no_adjust();
319 friend void center();
320 friend void right_justify();
321 friend void vertical_spacing();
322 friend void post_vertical_spacing();
323 friend void line_spacing();
324 friend void line_length();
325 friend void indent();
326 friend void temporary_indent();
327 friend void do_underline(int);
328 friend void do_input_trap(int);
329 friend void set_tabs();
330 friend void margin_character();
331 friend void no_number();
332 friend void number_lines();
333 friend void leader_character();
334 friend void tab_character();
335 friend void hyphenate_request();
336 friend void no_hyphenate();
337 friend void hyphen_line_max_request();
338 friend void hyphenation_space_request();
339 friend void hyphenation_margin_request();
340 friend void line_width();
342 friend void tabs_save();
343 friend void tabs_restore();
345 friend void line_tabs_request();
348 friend void widow_control_request();
349 #endif /* WIDOW_CONTROL */
351 friend void do_divert(int append
, int boxing
);
354 extern environment
*curenv
;
355 extern void pop_env();
356 extern void push_env(int);
358 void init_environments();
359 void read_hyphen_file(const char *name
);
362 extern double spread_limit
;
364 extern int break_flag
;
365 extern symbol default_family
;
366 extern int translate_space_to_dummy
;
368 extern unsigned char hpf_code_table
[];