/* * Write one label, with all the trimmings. * This routine is used for both 2D and 3D plots. */ void write_label(unsigned int x, unsigned int y, struct text_label *this_label) { int htic, vtic; int justify = JUST_TOP; /* This was the 2D default; 3D had CENTRE */ apply_pm3dcolor(&(this_label->textcolor),term); ignore_enhanced(this_label->noenhanced); get_offsets(this_label, term, &htic, &vtic); if (this_label->rotate && (*term->text_angle) (this_label->rotate)) { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, this_label->rotate, this_label->font); (*term->text_angle) (0); } else { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, 0, this_label->font); } /* write_multiline() clips text to on_page; do the same for any point */ if (this_label->lp_properties.pointflag && on_page(x,y)) { term_apply_lp_properties(&this_label->lp_properties); (*term->point) (x, y, this_label->lp_properties.p_type); /* the default label color is that of border */ term_apply_lp_properties(&border_lp); } ignore_enhanced(FALSE); }
/* * Write one label, with all the trimmings. * This routine is used for both 2D and 3D plots. */ void write_label(unsigned int x, unsigned int y, struct text_label *this_label) { int htic, vtic; int justify = JUST_TOP; /* This was the 2D default; 3D had CENTRE */ apply_pm3dcolor(&(this_label->textcolor),term); ignore_enhanced(this_label->noenhanced); /* The text itself */ if (this_label->hypertext) { /* Treat text as hypertext */ char *font = this_label->font; if (font) term->set_font(font); if (term->hypertext) term->hypertext(TERM_HYPERTEXT_TOOLTIP, this_label->text); if (font) term->set_font(""); } else { /* A normal label (always print text) */ get_offsets(this_label, term, &htic, &vtic); #ifdef EAM_BOXED_TEXT /* Initialize the bounding box accounting */ if (this_label->boxed && term->boxed_text) (*term->boxed_text)(x + htic, y + vtic, TEXTBOX_INIT); #endif if (this_label->rotate && (*term->text_angle) (this_label->rotate)) { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, this_label->rotate, this_label->font); (*term->text_angle) (0); } else { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, 0, this_label->font); } } #ifdef EAM_BOXED_TEXT /* Adjust the bounding box margins */ if (this_label->boxed && term->boxed_text) (*term->boxed_text)((int)(textbox_opts.xmargin * 100.), (int)(textbox_opts.ymargin * 100.), TEXTBOX_MARGINS); if (this_label->boxed && term->boxed_text && textbox_opts.opaque) { /* Blank out the box and reprint the label */ (*term->boxed_text)(0,0, TEXTBOX_BACKGROUNDFILL); if (this_label->rotate && (*term->text_angle) (this_label->rotate)) { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, this_label->rotate, this_label->font); (*term->text_angle) (0); } else { write_multiline(x + htic, y + vtic, this_label->text, this_label->pos, justify, 0, this_label->font); } } /* Draw the bounding box - FIXME should set line properties first */ if (this_label->boxed && term->boxed_text) { if (!textbox_opts.noborder) (*term->boxed_text)(0,0, TEXTBOX_OUTLINE); else (*term->boxed_text)(0,0, TEXTBOX_FINISH); } #endif /* The associated point, if any */ /* write_multiline() clips text to on_page; do the same for any point */ if ((this_label->lp_properties.flags & LP_SHOW_POINTS) && on_page(x,y)) { term_apply_lp_properties(&this_label->lp_properties); (*term->point) (x, y, this_label->lp_properties.p_type); /* the default label color is that of border */ term_apply_lp_properties(&border_lp); } ignore_enhanced(FALSE); }