TEXT

Syntax

int_val = TEXT ( x, y, str );
Input arguments
float x, y The coordinates of the text origin.
string str The text content.

Return Values

Success:
int 0  
Failure:
int -1 Script interface error.

Description

This function prints the text string with the text origin at x, y (see CENTER). To apply also formatting to the text, use TEXTEX instead.

Example

The code below defines a new text style: "text in box".

Note: If used as a new custom text type accessible from the list of texts, the program expects the 2D symbol to have the following properties: the name of the symbol must be "textn" where n is the index to the text type. Also the argument list is fixed.

Copy
text1( STRING datastr, x, y, ccnt, height, width, spc, lorg, ldir, slant, color, pen )
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Draws a text inside a box *
* Local origin of the box is located at the lower left corner. *
* All measures are real millimeters. *
* NOTE: DOES NOT SUPPORT LABEL ORIGIN -- ALL TEXT WILL HAVE A FIXED ORIGIN *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
    COLOR( color );
    DIREC( ldir );
    CENTER(5);
    TEXT( 0.0, 0.0, datastr );
    h_width = ( ccnt * ( width + spc ) + .7 * width ) / 2;
    h_height = ( height + .7 * width ) / 2;
    s_x = SIN( ldir ) * h_width;
    s_y = SIN( ldir ) * h_height;
    c_x = COS( ldir ) * h_width;
    c_y = COS( ldir ) * h_height;
    POLY( - c_x + s_y, - s_x - c_y,
    c_x + s_y, s_x - c_y,
    c_x - s_y, s_x + c_y,
    - c_x - s_y, - s_x + c_y,
    - c_x + s_y, - s_x - c_y );
}

Function Set

Text Functions

Related Functions

CENTER

DIREC

FONT

GET_TEXT_EXTENTS

SIZE

SLANT