extern void gml_note( const gmltag * entry ) { char * p; font_number font_save; text_chars * marker; uint32_t spc_cnt; scan_err = false; p = scan_start; start_doc_sect(); // if not already done scr_process_break(); font_save = g_curr_font; g_curr_font = layout_work.note.font; set_skip_vars( &layout_work.note.pre_skip, NULL, &layout_work.note.post_skip, spacing, g_curr_font ); post_space = 0; if( nest_cb->c_tag == t_NONE ) { g_cur_left = g_page_left + conv_hor_unit( &layout_work.note.left_indent, g_curr_font ); } else { g_cur_left += conv_hor_unit( &layout_work.note.left_indent, g_curr_font ); } g_cur_h_start = g_cur_left; ProcFlags.keep_left_margin = true; // keep special Note indent start_line_with_string( layout_work.note.string, layout_work.note.font, false ); /* the value of post_space after start_line_with_string() is wrong for */ /* two reasons: 1) it uses the wrong font; 2) it is at most "1" even if */ /* more than one space appears at the end of the note_string. */ spc_cnt = post_space / wgml_fonts[g_curr_font].spc_width; post_space = spc_cnt * wgml_fonts[font_save].spc_width; if( (t_line != NULL) && (t_line->last != NULL) ) { g_cur_left += t_line->last->width + post_space; } g_cur_h_start = g_cur_left; ju_x_start = g_cur_h_start; spacing = layout_work.note.spacing; g_curr_font = layout_work.defaults.font; set_skip_vars( NULL, NULL, NULL, spacing, g_curr_font ); if( *p == '.' ) p++; // over '.' while( *p == ' ' ) p++; // skip initial space if( *p ) { // if text follows post_space = 0; process_text( p, g_curr_font ); } else if( !ProcFlags.concat && ProcFlags.has_aa_block && (t_line != NULL) && (post_space > 0) ) { /* only create marker if line not empty, */ /* :NOTE note_string is not nullstring and ends in at least 1 space */ marker = alloc_text_chars( NULL, 0, font_save ); marker->x_address = g_cur_h_start; if( t_line->first == NULL ) { t_line->first = marker; t_line->last = t_line->first; } else { marker->prev = t_line->last; t_line->last->next = marker; t_line->last = t_line->last->next; } post_space = 0; } g_curr_font = font_save; scan_start = scan_stop + 1; return; }
static void gml_li_ol( const gmltag * entry ) { char charnumber[MAX_L_AS_STR]; char * p; char * pn; int32_t t_align = 0; int32_t t_left_indent_1 = 0; int32_t t_left_indent_2 = 0; int32_t t_right_indent = 0; uint32_t num_len; scan_err = false; p = scan_start; if( nest_cb == NULL ) { xx_nest_err( err_li_lp_no_list ); // tag must be in a list scan_start = scan_stop + 1; return; } t_align = conv_hor_unit( &((ol_lay_level *)(nest_cb->lay_tag))->align, g_curr_font ); nest_cb->li_number++; pn = format_num( nest_cb->li_number, charnumber, MAX_L_AS_STR, ((ol_lay_level *)(nest_cb->lay_tag))->number_style ); if( pn != NULL ) { num_len = strlen( pn ); *(pn + num_len) = ' '; // trailing space like wgml4 does *(pn + num_len + 1) = '\0'; num_len++; } else { pn = charnumber; *pn = '?'; *(pn + 1) = 0; num_len = 1; } scr_process_break(); g_curr_font = ((ol_lay_level *)(nest_cb->lay_tag))->number_font; if( ProcFlags.need_li_lp ) { // first :li for this list set_skip_vars( &nest_cb->xl_pre_skip, NULL, NULL, 1, g_curr_font ); } else if( !nest_cb->compact ) { set_skip_vars( &((ol_lay_level *)(nest_cb->lay_tag))->skip, NULL, NULL, 1, g_curr_font ); } else { // compact set_skip_vars( NULL, NULL, NULL, 1, g_curr_font ); } post_space = 0; /* Use original indents, not values possibly modified by IN */ if( g_indent > 0 ) { t_left_indent_1 = conv_hor_unit( &((ol_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ) + nest_cb->prev->left_indent + nest_cb->prev->align; } else { t_left_indent_1 = conv_hor_unit( &((ol_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ) + nest_cb->prev->left_indent; } t_left_indent_2 = conv_hor_unit( &((ol_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ); t_right_indent = -1 * conv_hor_unit( &((ol_lay_level *)(nest_cb->lay_tag))->right_indent, g_curr_font ) + nest_cb->prev->right_indent; g_cur_left = nest_cb->lm + t_left_indent_2; g_page_right = nest_cb->rm + t_right_indent; g_cur_h_start = g_cur_left; ProcFlags.keep_left_margin = true; // keep special Note indent start_line_with_string( charnumber, g_curr_font, true ); g_cur_h_start = g_cur_left + t_align; if( t_line != NULL ) { if( t_line->last != NULL ) { g_cur_left += t_line->last->width + post_space; } } post_space = 0; if( g_cur_h_start > g_cur_left ) { g_cur_left = g_cur_h_start; } g_cur_h_start = g_cur_left; ju_x_start = g_cur_h_start; g_curr_font = ((ol_lay_level *)(nest_cb->lay_tag))->font; if( *p == '.' ) p++; // over '.' while( *p == ' ' ) p++; // skip initial spaces ProcFlags.need_li_lp = false; // 1. item in list processed if( *p ) { process_text( p, g_curr_font ); // if text follows } nest_cb->align = t_align; /* Set indents to their original values for the next LI */ if( g_indent > 0 ) { nest_cb->left_indent = t_left_indent_1; } else { nest_cb->left_indent = t_left_indent_1 + nest_cb->prev->align; } nest_cb->right_indent = t_right_indent; scan_start = scan_stop + 1; return; }
static void gml_li_ul( const gmltag * entry ) { char * p; char bullet[3]; int32_t t_align = 0; int32_t t_left_indent_1 = 0; int32_t t_left_indent_2 = 0; int32_t t_right_indent = 0; scan_err = false; p = scan_start; if( nest_cb == NULL ) { xx_nest_err( err_li_lp_no_list ); // tag must be in a list scan_start = scan_stop + 1; return; } if( ((ul_lay_level *)(nest_cb->lay_tag))->bullet_translate ) { bullet[0] = cop_in_trans( ((ul_lay_level *)(nest_cb->lay_tag))->bullet, ((ul_lay_level *)(nest_cb->lay_tag))->bullet_font ); } else { bullet[0] = ((ul_lay_level *)(nest_cb->lay_tag))->bullet; } bullet[1] = ' '; // 1 trailing space as wgml4 does bullet[2] = 0; scr_process_break(); if( ProcFlags.need_li_lp ) { // first :li for this list set_skip_vars( &nest_cb->xl_pre_skip, NULL, NULL, 1, g_curr_font ); } else if( !nest_cb->compact ) { set_skip_vars( &((ul_lay_level *)(nest_cb->lay_tag))->skip, NULL, NULL, 1, g_curr_font ); } else { // compact set_skip_vars( NULL, NULL, NULL, 1, g_curr_font ); } g_curr_font = ((ul_lay_level *)(nest_cb->lay_tag))->bullet_font; post_space = 0; /* Use original indents, not values possibly modified by IN */ if( g_indent > 0 ) { t_left_indent_1 = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ) + nest_cb->prev->left_indent + nest_cb->prev->align; } else { t_left_indent_1 = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ) + nest_cb->prev->left_indent; } t_left_indent_2 = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font ); t_right_indent = -1 * conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->right_indent, g_curr_font ) + nest_cb->prev->right_indent; g_cur_left = nest_cb->lm + t_left_indent_2; g_page_right = nest_cb->rm + t_right_indent; g_cur_h_start = g_cur_left; ProcFlags.keep_left_margin = true; // keep special Note indent start_line_with_string( bullet, g_curr_font, true ); t_align = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->align, g_curr_font ); g_cur_h_start = g_cur_left + t_align; if( t_line != NULL ) { if( t_line->last != NULL ) { g_cur_left += t_line->last->width + post_space; } } post_space = 0; if( g_cur_h_start > g_cur_left ) { g_cur_left = g_cur_h_start; } g_cur_h_start = g_cur_left; ju_x_start = g_cur_h_start; g_curr_font = ((ul_lay_level *)(nest_cb->lay_tag))->font; if( *p == '.' ) p++; // over '.' while( *p == ' ' ) p++; // skip initial spaces ProcFlags.need_li_lp = false; if( *p ) { process_text( p, g_curr_font ); // if text fullows } nest_cb->align = t_align; g_cur_left = nest_cb->lm + t_left_indent_2 + nest_cb->align; /* Set indents to their original values for the next LI */ if( g_indent > 0 ) { nest_cb->left_indent = t_left_indent_1; } else { nest_cb->left_indent = t_left_indent_1 + nest_cb->prev->align; } nest_cb->right_indent = t_right_indent; scan_start = scan_stop + 1; return; }
static void gml_li_ul( const gmltag * entry ) { char * p; char bullet[3]; entry = entry; scan_err = false; p = scan_start; if( nest_cb == NULL ) { xx_nest_err( err_li_lp_no_list ); // tag must be in a list scan_start = scan_stop + 1; return; } if( ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_translate ) { bullet[0] = cop_in_trans( ((ul_lay_tag *)(nest_cb->lay_tag))->bullet, ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_font ); } else { bullet[0] = ((ul_lay_tag *)(nest_cb->lay_tag))->bullet; } bullet[1] = ' '; // 1 trailing space as wgml4 does bullet[2] = 0; scr_process_break(); if( ProcFlags.need_li_lp ) { // first :li for this list set_skip_vars( &((ul_lay_tag *)(nest_cb->lay_tag))->pre_skip, NULL, NULL, 1, g_curr_font ); } else if( !nest_cb->compact ) { set_skip_vars( &((ul_lay_tag *)(nest_cb->lay_tag))->skip, NULL, NULL, 1, g_curr_font ); } else { // compact set_skip_vars( NULL, NULL, NULL, 1, g_curr_font ); } spacing = ((ul_lay_tag *)(nest_cb->lay_tag))->spacing; g_curr_font = ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_font; post_space = 0; g_cur_left = nest_cb->lm + nest_cb->left_indent; g_cur_h_start = g_cur_left; g_page_right = nest_cb->rm - nest_cb->right_indent; ProcFlags.keep_left_margin = true; // keep special Note indent start_line_with_string( bullet, g_curr_font, true ); g_cur_h_start = g_cur_left + conv_hor_unit( &(((ul_lay_tag *)(nest_cb->lay_tag))->align) ); if( t_line != NULL ) { if( t_line->last != NULL ) { g_cur_left += t_line->last->width + post_space; } } post_space = 0; if( g_cur_h_start > g_cur_left ) { g_cur_left = g_cur_h_start; } g_cur_h_start = g_cur_left; ju_x_start = g_cur_h_start; spacing = ((ul_lay_tag *)(nest_cb->lay_tag))->spacing; g_curr_font = ((ul_lay_tag *)(nest_cb->lay_tag))->font; if( *p == '.' ) p++; // over '.' while( *p == ' ' ) p++; // skip initial spaces ProcFlags.need_li_lp = false; if( *p ) { process_text( p, g_curr_font ); // if text fullows } scan_start = scan_stop + 1; return; }