stringbox - Calcule le rectangle englobant d'un texte ou d'un label.
stringbox renvoie les positions des quatres sommets du rectangle englobant d'un objet Text ou Label ou d'une chaine de caractère que l'on souhaite afficher. Les coordonnées sont données dans l'échelle graphique courante. Le premier sommet correspond à la coordonnées du texte, le point en bas à gauche sans rotations, les suivants sont donnés dans le sens des aiguilles d'une montre.
Le résultat est approximatif avec le pilote PostScript.
// show axes axes = gca() ; axes.axes_visible = 'on' ; axes.data_bounds = [ 1, 1 ; 10, 10 ] ; // display a labels for axes xtitle( 'stringbox', 'X', 'Y' ) ; // get the bounding box of X label stringbox( axes.x_label ) // draw a string str = [ "Scilab", "is" , "not", "Skylab" ] ; xstring( 4, 9, str ) ; //modify the text e = gce() ; e.font_angle = 90 ; e.font_size = 6 ; e.font_style = 7 ; e.box = 'on' ; // get its bounding box stringbox( e ) // or rect = stringbox( str, 4, 9, 90, 6, 5 ) // click and find if the text was hit hit = xclick() ; hit = hit( 2 : 3 ) ; if hit(1) >= rect(1,1) & hit(1) <= rect(1,2) & hit(2) <= rect(2,2) & hit(2) >= rect(2,3) then disp('You hit the text.') ; else disp('You missed it.') end;
xstring , xstringl , xstringb ,
Jean-Baptiste Silvy