1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
<?xml version="1.0" encoding="UTF-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="fr" xml:id="stringbox">
<info>
<pubdate>$LastChangedDate$</pubdate>
</info>
<refnamediv>
<refname>stringbox</refname>
<refpurpose>Calcule le rectangle englobant d'un
texte ou d'un label.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Séquence d'appel</title>
<synopsis>rect = stringbox( string, x, y, [angle, [fontStyle, [fontSize]]] )
rect = stringbox( handle )</synopsis>
</refsynopsisdiv>
<refsection>
<title>Paramètres</title>
<variablelist>
<varlistentry>
<term>rect</term>
<listitem>
<para>matrice 2x4 contenant les coordonées des 4 sommets du
rectangle englobant.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>string</term>
<listitem>
<para>matrice de chaine de caractère à entourer.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>x,y</term>
<listitem>
<para>scalaires réels, coordonnées du point en bas à gauche des
chaînes de caractères.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>angle</term>
<listitem>
<para>Angle de rotation de la chaîne en degrés autour du point
<literal>(x,y)</literal> dans le sens des aiguilles d'une montre.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>fonStyle</term>
<listitem>
<para>un entier specifiant le type de la fonte.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>fontSize</term>
<listitem>
<para>un entier specifiant la taille de la fonte.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>handle</term>
<listitem>
<para>un handle de type Text ou Label.</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para><literal>stringbox</literal> 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.</para>
<para>Le résultat est approximatif avec le pilote PostScript.</para>
</refsection>
<refsection>
<title>Exemples</title>
<programlisting role="example"><![CDATA[
// 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, 7, 6 )
// 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;
]]></programlisting>
</refsection>
<refsection>
<title>Voir Aussi</title>
<simplelist type="inline">
<member>
<link linkend="xstring">xstring</link>
</member>
<member>
<link linkend="xstringl">xstringl</link>
</member>
<member>
<link linkend="xstringb">xstringb</link>
</member>
</simplelist>
</refsection>
<refsection>
<title>Auteurs</title>
<para>Jean-Baptiste Silvy</para>
</refsection>
</refentry>
|