manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.7 Text printing

These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. MathGL can use arbitrary font-faces and parse many TeX commands (for more details see Font styles). All these functions have 2 variant: for printing 8-bit text (char *) and for printing Unicode text (wchar_t *). In first case the conversion into the current locale is used. So sometimes you need to specify it by setlocale() function. The size argument control the size of text: if positive it give the value, if negative it give the value relative to SetFontSize(). The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See section Font settings.

The font parameters are described by string. This string may set the text color ‘wkrgbcymhRGBCYMHW’ (see Color styles). Also, after delimiter symbol ‘:’, it can contain characters of font type (‘rbiwou’) and/or align (‘LRC’) specification. The font types are: ‘r’ – roman (or regular) font, ‘i’ – italic style, ‘b’ – bold style, ‘w’ – wired style, ‘o’ – over-lined text, ‘u’ – underlined text. By default roman font is used. The align types are: ‘L’ – align left (default), ‘C’ – align center, ‘R’ – align right. For example, string ‘b:iC’ correspond to italic font style for centered text which printed by blue color.

If string contains symbols ‘aA’ then text is printed at absolute position {x, y} (supposed to be in range [0,1]) of picture (for ‘A’) or subplot/inplot (for ‘a’). If string contains symbol ‘@’ then box around text is drawn.

See section Text features, for sample code and picture.

MGL command: text x y 'text' ['fnt'='' size=-1]
MGL command: text x y z 'text' ['fnt'='' size=-1]
Method on mglGraph: void Puts (mglPoint p, const char *text, const char *fnt=":C", mreal size=-1)
Method on mglGraph: void Putsw (mglPoint p, const wchar_t *text, const char *fnt=":C", mreal size=-1)
Method on mglGraph: void Puts (mreal x, mreal y, const char *text, const char *fnt=":AC", mreal size=-1)
Method on mglGraph: void Putsw (mreal x, mreal y, const wchar_t *text, const char *fnt=":AC", mreal size=-1)
C function: void mgl_puts (HMGL gr, mreal x, mreal y, mreal z, const char *text, const char *fnt, mreal size)
C function: void mgl_putsw (HMGL gr, mreal x, mreal y, mreal z, const wchar_t *text, const char *fnt, mreal size)

The function plots the string text at position p with fonts specifying by the criteria fnt. The size of font is set by size parameter (default is -1).

MGL command: text x y dx dy 'text' ['fnt'=':L' size=-1]
MGL command: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
Method on mglGraph: void Puts (mglPoint p, mglPoint d, const char *text, const char *fnt=":L", mreal size=-1)
Method on mglGraph: void Putsw (mglPoint p, mglPoint d, const wchar_t *text, const char *fnt=":L", mreal size=-1)
C function: void mgl_puts_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
C function: void mgl_putsw_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const wchar_t *text, const char *fnt, mreal size)

The function plots the string text at position p along direction d with specified size. Parameter fnt set text style and text position: above (‘T’) or under (‘t’) the line.

MGL command: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
MGL command: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]

Draws unrotated n-th line of file fname at position {x,y,z} with specified size. By default parameters from font command are used.

MGL command: text ydat 'text' ['fnt'='']
MGL command: text xdat ydat 'text' ['fnt'='']
MGL command: text xdat ydat zdat 'text' ['fnt'='']
Method on mglGraph: void Text (const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
Method on mglGraph: void Text (const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")
Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")
C function: void mgl_text_y (HMGL gr, HCDT y, const char *text, const char *fnt, const char *opt)
C function: void mgl_textw_y (HMGL gr, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
C function: void mgl_text_xy (HCDT x, HCDT y, const char *text, const char *fnt, const char *opt)
C function: void mgl_textw_xy (HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
C function: void mgl_text_xyz (HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt)
C function: void mgl_textw_xyz (HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt)

The function draws text along the curve between points {x[i], y[i], z[i]} by font style fnt. The string fnt may contain symbols ‘t’ for printing the text under the curve (default), or ‘T’ for printing the text above the curve. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. If array x is not specified then its an automatic array is used with values equidistantly distributed in interval [Min.x, Max.x] (see Ranges (bounding box)). If array z is not specified then z[i] = Min.z is used. String opt contain command options (see Command options).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on March 21, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.