GET_TEXT_EXTENTS
Syntax
int_val = GET_TEXT_EXTENTS( string, height, width );
- Input arguments
-
string string The contents of the text.
- Output arguments
-
float height Text height without margins. If the given text has zero length, height = 0.0. float width Text width without margins.
Return Values
- Success:
-
int Amount of characters in the string.
- Failure:
-
int -1 Script interface error.
Description
This function counts minimum bounding box for the given text.
The calculation method depends on the current font (CADMATIC font vs. truetype font)
Example
You can find texts using this function from the Example Environment. Below you can see part of text11 which draws a label text inside a box with a reference line.
Copy
SIZE(height, width, spc);
COLOR(color);
DIREC(ldir);
CENTER(5);
h_width = 0.0; h_height = 0.0;
st = GET_TEXT_EXTENTS (datastr,h_height,h_width);
if (st < 1)
st = GET_TEXT_EXTENTS ("X",h_height,h_width);
if (st < 0){
h_width = 1.0;
h_height = 1.0;
}