| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8.8 Text printing (Pure C)
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 mgl_load_font(). 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 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.
- 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 {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.
- 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 {x,y,z} along direction {dx,dy,dz} with specified size.
- 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()).
- 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) (Pure C)). 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] | [ ? ] |
