AIS_TextLabel Measurements/Bounds

Hello,

I'm using AIS_TextLabel to show a 3D located and rotated 'decal' on the surface of another object.  I would like to be able to position it based on the centre of the first letter, for example.  In order to do this, I need some way to measure the bounds of a label, before displaying it.

I've experimented in a debugger, but the bounds appear to be only set when added to the viewer and, in my case, I found that the min and max were set to the same value immediately after added to the view.

Is there a way to 'pre-measure' the world size of a label?
Many thanks,

Pete
 

 

 

 

 

 

Kirill Gavrilov's picture

Why would you need using center of first letter? This sounds awkward.
Note that text alignment relative to anchor 3D point is manged by two enumerations Graphic3d_VerticalTextAlignment and Graphic3d_HorizontalTextAlignment.

Apart from graphic tools like AIS_TextLabel displaying text in 3D viewer, there is also Font_BRepTextBuilder building TopoDS_Shape from text.