[ < ] | [ > ] | [ << ] | [ 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++):void
Puts (mglPoint
p,const char *
text,const char *
font=""
,float
size=-1
,char
dir=0
,float
shift=0
) - Method on
mglGraph
(C++):void
Putsw (mglPoint
p,const wchar_t *
text,const char *
font=""
,float
size=-1
,char
dir=0
,float
shift=0
) - Method on
mglGraph
(Python):void
Puts (float
x,float
y,float
z,const char *
text,const char *
font=""
,float
size=-1
,char
dir=0
) - C function:
void
mgl_puts (HMGL
gr,float
x,float
y,float
z,const char *
text) - C function:
void
mgl_putsw (HMGL
gr,float
x,float
y,float
z,const wchar_t *
text) - C function:
void
mgl_puts_ext (HMGL
gr,float
x,float
y,float
z,const char *
text,const char *
font,float
size,char
dir) - C function:
void
mgl_putsw_ext (HMGL
gr,float
x,float
y,float
z,const wchar_t *
text,const char *
font,float
size,char
dir) 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++):float
Puts (mglPoint
p,mglPoint
l,const char *
text,char
where='t'
,float
size=-1
) - Method on
mglGraph
(C++):float
Putsw (mglPoint
p,mglPoint
l,const wchar_t *
text,char
where='t'
,float
size=-1
) - Method on
mglGraph
(Python):void
Puts (float
x,float
y,float
z,float
dx,float
dy,float
dz,const char *
text,char
where='t'
,float
size=-1
) - C function:
void
mgl_puts_dir (HMGL
gr,float
x,float
y,float
z,float
dx,float
dy,float
dz,const char *
text,float
size) - C function:
void
mgl_putsw_dir (HMGL
gr,float
x,float
y,float
z,float
dx,float
dy,float
dz,const wchar_t *
text,float
size) 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++):void
Text (mglPoint
p,const char *
text,const char *
font=""
,float
size=-1
,char
dir=0
) - Method on
mglGraph
(C++):void
Text (mglPoint
p,const wchar_t *
text,const char *
font=""
,float
size=-1
,char
dir=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++):void
Printf (mglPoint
p,const char *
arg, ...) Print formatted string at point p.
- Method on
mglGraph
(C++):void
Label (float
x,float
y,const char *
text,const char *
font=""
,float
size=-1
) - Method on
mglGraph
(C++):void
Labelw (float
x,float
y,const wchar_t *
text,const char *
font=""
,float
size=-1
) - C function:
void
mgl_label_xy (HMGL
gr,float
x,float
y,const char *
text,const char *
font,float
size) - C function:
void
mgl_labelw_xy (HMGL
gr,float
x,float
y,const wchar_t *
text,const char *
font,float
size) 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, y
are supposed to be in range [0,1].
- Method on
mglGraph
(C++):void
Title (const char *
text,const char *
font=0
,float
size=-2
) - Method on
mglGraph
(C++):void
Title (const wchar_t *
text,const char *
font=0
,float
size=-2
) - Method on
mglGraph
(Python):void
Title (const char *
text,const char *
font=0
,int
size=-2
) - C function:
void
mgl_title (HMGL
gr,const char *
text,const char *
font,int
size) - C function:
void
mgl_titlew (HMGL
gr,const wchar_t *
text,const char *
font,int
size) 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):void
Text (const mglData &
y,const char *
text,const char *
font=""
, float size=-1
) - Method on
mglGraph
(C++):void
Text (const mglData &
y,const wchar_t *
text,const char *
font=""
, float size=-1
) - Method on
mglGraph
(C++, Python):void
Text (const mglData &
x,const mglData &
y,const char *
text,const char *
font=""
, float size=-1
) - Method on
mglGraph
(C++):void
Text (const mglData &
x,const mglData &
y,const wchar_t *
text,const char *
font=""
, float size=-1
) - Method on
mglGraph
(C++, Python):void
Text (const mglData &
x,const mglData &
y,const mglData &
z,const char *
text,const char *
font=""
, float size=-1
) - Method on
mglGraph
(C++):void
Text (const mglData &
x,const mglData &
y,const mglData &
z,const wchar_t *
text,const char *
font=""
, float size=-1
) - C function:
void
mgl_text_y (HMGL
gr,const HMDT
y,const char *
text,const char *
font, float size) - C function:
void
mgl_text_xy (const HMDT
x,const HMDT
y,const char *
text,const char *
font, float size) - C function:
void
mgl_text_xyz (const HMDT
x,const HMDT
y,const HMDT
z,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] | [ ? ] |