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

9.6 Text printing (Python)

These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. The class mglFont (see section mglFont class) is used for low-level string parsing and printing. It can use arbitrary font-faces and parse many TeX commands. All these functions have 2 variant: for printing 8-bit text (char *) and for printing Unicode text (wchar_t *). In first case the conversion in 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 FontSize. The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See section Font settings (Python).

The font parameters are described by string. This string may contain several characters of font type (‘rbiwou’) and/or align (‘LRC’) specification. Also it may contain the text color ‘wkrgbcymhRGBCYMHW’ (see section mglColor class) after symbol ‘:’. The font types are: ‘r’ – roman 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. Also a parsing of the LaTeX-like syntax is provided (for detail see section mglFont class). For example, string ‘iC:b’ correspond to italic font style for centered text which printed by blue color.

Method on mglGraph (Python): void Puts (float x, float y, float z, const char *text, const char *font=NULL, float size=-1, char dir=0)
Method on mglGraph (Python): void Putsw (float x, float y, float z, const wchar_t *text, const char *font=NULL, float size=-1, char dir=0)

The function plots the string text at position {x,y,z} with fonts specifying by the criteria how. The size of font is set by size parameter (default is FontSize). Parameter dir specifies the additional string align. The aligns are: ‘x’ – align as x-label, ‘y’ – align as y-label, ‘z’ – align as z-label, ‘i’ – align as x-label but inverse writing direction, ‘t’ – no align (default), ‘n’ – align in x-y plane.

Method on mglGraph (Python): void Puts (float x, float y, float z, float dx, float dy, float dz, const char *text, charwhere='t', float size=-1)
Method on mglGraph (Python): void Putsw (float x, float y, float z, float dx, float dy, float dz, const wchar_t *text, charwhere='t', float size=-1)

The function plots the string text at position {x,y,z} along direction {dx,dy,dz} with specified size.

Method on mglGraph (Python): void Title (const char *text, const char *font=0, int size=-2)
Method on mglGraph (Python): void Title (const wchar_t *text, const char *font=0, int size=-2)

Print string text as title of the picture (at the top of the picture). Can be used at any place (even inside SubPlot()).

Method on mglGraph (Python): void Text (mglData y, const char *text, const char *font=NULL, float size=-1)
Method on mglGraph (Python): void Text (mglData y, const wchar_t *text, const char *font=NULL, float size=-1)
Method on mglGraph (Python): void Text (mglData x, mglData y, const char *text, const char *font=NULL, float size=-1)
Method on mglGraph (Python): void Text (mglData x, mglData y, const wchar_t *text, const char *font=NULL, float size=-1)
Method on mglGraph (Python): void Text (mglData x, mglData y, mglData z, const char *text, const char *font=NULL, float size=-1)
Method on mglGraph (Python): void Text (mglData x, mglData y, mglData z, const wchar_t *text, const char *font=NULL, float size=-1)

The function draws text along the curve between points {x[i], y[i], z[i]} by font style font and with size size. The string font 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 section Ranges (bounding box)). See section Text sample, for sample code and picture.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2026
Individual documents may contain additional copyright information.