| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.6 Text printing
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 (for detail see section 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 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 SetFont(), GetFont(). See section Font settings.
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 Line styles) 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. For example, string ‘iC:b’ correspond to italic font style for centered text which printed by blue color.
If string contains symbols ‘aA’ then text is printed at arbitrary position {x, y} (supposed to be in range [0,1]) of subplot (for ‘a’) or picture (for ‘A’).
- Method on
mglGraph(C++):voidPuts (mglPointp,const char *text,const char *font="",floatsize=-1,chardir=0,floatshift=0) - Method on
mglGraph(C++):voidPutsw (mglPointp,const wchar_t *text,const char *font="",floatsize=-1,chardir=0,floatshift=0) - Method on
mglGraph(Python):voidPuts (floatx,floaty,floatz,const char *text,const char *font="",floatsize=-1,chardir=0) - C function:
voidmgl_puts (HMGLgr,floatx,floaty,floatz,const char *text) - C function:
voidmgl_putsw (HMGLgr,floatx,floaty,floatz,const wchar_t *text) - C function:
voidmgl_puts_ext (HMGLgr,floatx,floaty,floatz,const char *text,const char *font,floatsize,chardir) - C function:
voidmgl_putsw_ext (HMGLgr,floatx,floaty,floatz,const wchar_t *text,const char *font,floatsize,chardir) The function plots the string text at position p 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(C++):floatPuts (mglPointp,mglPointl,const char *text,charwhere='t',floatsize=-1) - Method on
mglGraph(C++):floatPutsw (mglPointp,mglPointl,const wchar_t *text,charwhere='t',floatsize=-1) - Method on
mglGraph(Python):voidPuts (floatx,floaty,floatz,floatdx,floatdy,floatdz,const char *text,charwhere='t',floatsize=-1) - C function:
voidmgl_puts_dir (HMGLgr,floatx,floaty,floatz,floatdx,floatdy,floatdz,const char *text,floatsize) - C function:
voidmgl_putsw_dir (HMGLgr,floatx,floaty,floatz,floatdx,floatdy,floatdz,const wchar_t *text,floatsize) The function plots the string text at position p along direction l with specified size. Parameter where set to print text above the line (‘T’) or under the line (‘t’). Function return the width of the string.
- Method on
mglGraph(C++):voidText (mglPointp,const char *text,const char *font="",floatsize=-1,chardir=0) - Method on
mglGraph(C++):voidText (mglPointp,const wchar_t *text,const char *font="",floatsize=-1,chardir=0) The function plots the string text at position p with fonts how. These functions are obsolete – use Puts(), Putsw() functions instead.
- Method on
mglGraph(C++):voidPrintf (mglPointp,const char *arg, ...) Print formatted string at point p.
- Method on
mglGraph(C++):voidLabel (floatx,floaty,const char *text,const char *font="",floatsize=-1) - Method on
mglGraph(C++):voidLabelw (floatx,floaty,const wchar_t *text,const char *font="",floatsize=-1) - C function:
voidmgl_label_xy (HMGLgr,floatx,floaty,const char *text,const char *font,floatsize) - C function:
voidmgl_labelw_xy (HMGLgr,floatx,floaty,const wchar_t *text,const char *font,floatsize) The function draws the string text at position {x, y} with fonts specifying by font. The size of font is set by size parameter (default is FontSize). Coordiantes
x, yare supposed to be in range [0,1].
- Method on
mglGraph(C++):voidTitle (const char *text,const char *font=0,floatsize=-2) - Method on
mglGraph(C++):voidTitle (const wchar_t *text,const char *font=0,floatsize=-2) - Method on
mglGraph(Python):voidTitle (const char *text,const char *font=0,intsize=-2) - C function:
voidmgl_title (HMGLgr,const char *text,const char *font,intsize) - C function:
voidmgl_titlew (HMGLgr,const wchar_t *text,const char *font,intsize) 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(C++, Python):voidText (const mglData &y,const char *text,const char *font="", float size=-1) - Method on
mglGraph(C++):voidText (const mglData &y,const wchar_t *text,const char *font="", float size=-1) - Method on
mglGraph(C++, Python):voidText (const mglData &x,const mglData &y,const char *text,const char *font="", float size=-1) - Method on
mglGraph(C++):voidText (const mglData &x,const mglData &y,const wchar_t *text,const char *font="", float size=-1) - Method on
mglGraph(C++, Python):voidText (const mglData &x,const mglData &y,const mglData &z,const char *text,const char *font="", float size=-1) - Method on
mglGraph(C++):voidText (const mglData &x,const mglData &y,const mglData &z,const wchar_t *text,const char *font="", float size=-1) - C function:
voidmgl_text_y (HMGLgr,const HMDTy,const char *text,const char *font, float size) - C function:
voidmgl_text_xy (const HMDTx,const HMDTy,const char *text,const char *font, float size) - C function:
voidmgl_text_xyz (const HMDTx,const HMDTy,const HMDTz,const char *text,const char *font, float size) 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)). If array z is not specified then z[i] = zVal is used. See section Text sample, for sample code and picture.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
