MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmt_map_text

Function gmt_map_text

src/gmt_plot.c:5625–5651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5623 */
5624
5625void gmt_map_text (struct GMT_CTRL *GMT, double x, double y, struct GMT_FONT *font, char *label, double angle, int just, unsigned int form) {
5626 /* Function to plot single-line text in pstext.c */
5627 struct PSL_CTRL *PSL= GMT->PSL;
5628
5629 if (gmt_text_is_latex (GMT, label)) { /* Detected LaTeX commands, i.e., "....@[LaTeX...@[ ..." or "....<math>LaTeX...</math> ..." */
5630 double w, h;
5631 unsigned char *eps = NULL;
5632 struct imageinfo header;
5633
5634 if ((eps = gmtplot_latex_eps (GMT, font, label, &header)) == NULL) {
5635 GMT_Report (GMT->parent, GMT_MSG_ERROR, "gmt_map_text: Conversion of LaTeX to EPS failed\n");
5636 return; /* Done */
5637 }
5638 /* Scale up EPS dimensions by the ratio of label font size to LaTeX default size of 10p */
5639 w = (header.width / 72.0) * (font->size / 10.0);
5640 h = (header.height / 72.0) * (font->size / 10.0);
5641 /* Place EPS file as label, then free eps */
5642 GMT_Report (GMT->parent, GMT_MSG_DEBUG, "gmt_map_text: Conversion of LaTeX gave dimensions %g x %g\n", w, h);
5643 PSL_command (PSL, "V\n"); /* Keep the relative changes inside a save/restore block */
5644 PSL_setorigin (PSL, x, y, angle, PSL_FWD); /* Move to desired point and possibly rotate to angle */
5645 PSL_plotlatexeps (PSL, 0.0, 0.0, w, h, just, eps, font->fill.rgb, &header); /* Place the EPS plot */
5646 PSL_command (PSL, "U\n"); /* Close up the block */
5647 PSL_free (eps);
5648 }
5649 else /* Regular text label */
5650 PSL_plottext (PSL, x, y, font->size, label, angle, just, form);
5651}
5652
5653void gmt_xy_axis (struct GMT_CTRL *GMT, double x0, double y0, double length, double val0, double val1, struct GMT_PLOT_AXIS *A, bool below, unsigned side) {
5654 unsigned int k, i, nx, nx1, np = 0;/* Misc. variables */

Callers 2

GMT_pstextFunction · 0.85
psscale_draw_colorbarFunction · 0.85

Calls 7

gmt_text_is_latexFunction · 0.85
gmtplot_latex_epsFunction · 0.85
GMT_ReportFunction · 0.85
PSL_commandFunction · 0.85
PSL_setoriginFunction · 0.85
PSL_plotlatexepsFunction · 0.85
PSL_plottextFunction · 0.85

Tested by

no test coverage detected