static void doc_header( su *p_sk, su *top_sk, xx_str *h_string, font_number font, spacing_line spacing_ln, bool no_eject ) { doc_element * cur_el; font_number font_save; int32_t h_left; text_chars * curr_t; text_line * hd_line; font_save = g_curr_font; g_curr_font = font; g_curr_font = font_save; set_skip_vars( NULL, top_sk, p_sk, spacing_ln, g_curr_font ); if( (h_string == NULL) || (*h_string == '\0') || (*h_string == ' ') || (*h_string == '\t') ) { /********************************************************/ /* header contained "yes" but the string was empty: */ /* the OW docs do this with APPENDIX for PS/PDF output */ /********************************************************/ hd_line = alloc_text_line(); // defaults work } else { curr_t = alloc_text_chars( h_string, strlen( h_string ), font ); curr_t->width = cop_text_width( curr_t->text, curr_t->count, font ); h_left = g_page_left +(g_page_right - g_page_left - curr_t->width) / 2; curr_t->x_address = h_left; hd_line = alloc_text_line(); hd_line->first = curr_t; hd_line->line_height = wgml_fonts[font].line_height; } if( input_cbs->fmflags & II_research ) { test_out_t_line( hd_line ); } cur_el = alloc_doc_el( el_text ); cur_el->blank_lines = g_blank_lines; g_blank_lines = 0; cur_el->depth = hd_line->line_height; cur_el->subs_skip = g_subs_skip; cur_el->top_skip = g_top_skip; cur_el->element.text.overprint = ProcFlags.overprint; ProcFlags.overprint = false; cur_el->element.text.spacing = g_spacing; cur_el->element.text.first = hd_line; ProcFlags.skips_valid = false; hd_line = NULL; if( no_eject ) { insert_col_main( cur_el ); } else { insert_page_width( cur_el ); } }
static void hx_header( int hx_lvl, const char *hnumstr, const char *txt ) { doc_element * cur_el; font_number font_save; font_number font; int32_t width; int32_t widthn; text_chars * curr_t; text_chars * curr_tn; text_line * hd_line; hd_line = NULL; font_save = g_curr_font; g_spacing_ln = layout_work.hx[hx_lvl].spacing; if( layout_work.hx[hx_lvl].line_break ) { set_skip_vars( &layout_work.hx[hx_lvl].pre_skip, &layout_work.hx[hx_lvl].pre_top_skip, &layout_work.hx[hx_lvl].post_skip, g_spacing_ln, layout_work.hx[hx_lvl].number_font ); } else { set_skip_vars( &layout_work.hx[hx_lvl].pre_skip, &layout_work.hx[hx_lvl].pre_top_skip, NULL, g_spacing_ln, layout_work.hx[hx_lvl].number_font ); } post_space = 0; curr_t = NULL; curr_tn = NULL; width = 0; widthn = 0; hd_line = alloc_text_line(); if( layout_work.hx[hx_lvl].number_form != num_none ) { font = layout_work.hx[hx_lvl].number_font; curr_tn = alloc_text_chars( hnumstr, strlen( hnumstr ), font ); curr_tn->width = cop_text_width( curr_tn->text, curr_tn->count, font ); widthn = curr_tn->width + wgml_fonts[font].spc_width;; hd_line->first = curr_tn; hd_line->line_height = wgml_fonts[font].line_height; hd_line->last = curr_tn; } if( (txt != NULL) && (*txt != '\0') ) { font = layout_work.hx[hx_lvl].font; curr_t = alloc_text_chars( txt, strlen( txt ), font ); curr_t->width = cop_text_width( curr_t->text, curr_t->count, font ); width = curr_t->width; if( hd_line->first == NULL ) { hd_line->first = curr_t; } else { curr_tn->next = curr_t; curr_t->prev = curr_tn; } hd_line->last = curr_t; if( hd_line->line_height < wgml_fonts[font].line_height ) { hd_line->line_height = wgml_fonts[font].line_height; } } if( curr_t == NULL ) { curr_t = curr_tn; curr_tn = NULL; width = widthn; widthn = 0; } g_cur_left = g_page_left + conv_hor_unit( &layout_work.hx[hx_lvl].indent ) + conv_hor_unit( &layout_work.hx[hx_lvl].align ); if( layout_work.hx[hx_lvl].page_position == pos_left ) { if( curr_tn != NULL ) { curr_tn->x_address = g_cur_left; } curr_t->x_address = g_cur_left + widthn; } else { if( layout_work.hx[hx_lvl].page_position == pos_center ) { curr_t->x_address = g_cur_left + widthn + (g_page_right - g_cur_left - widthn - width) / 2; } else { curr_t->x_address = g_page_right - width; } if( curr_tn != NULL ) { curr_tn->x_address = curr_t->x_address - widthn; } } if( input_cbs->fmflags & II_research ) { test_out_t_line( hd_line ); } cur_el = alloc_doc_el( el_text ); cur_el->blank_lines = g_blank_lines; g_blank_lines = 0; cur_el->depth = hd_line->line_height; cur_el->subs_skip = g_subs_skip; cur_el->top_skip = g_top_skip; cur_el->element.text.overprint = ProcFlags.overprint; ProcFlags.overprint = false; cur_el->element.text.spacing = g_spacing; cur_el->element.text.first = hd_line; ProcFlags.skips_valid = false; hd_line = NULL; if( layout_work.hx[hx_lvl].page_eject == ej_no ) { insert_col_main( cur_el ); } else { insert_page_width( cur_el ); } }