Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.1 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Graphics > text > stringbox

stringbox

テキストまたはラベルのバウンディングボックスを計算

呼び出し手順

rect = stringbox( string, x, y, [angle, [fontStyle, [fontSize]]] )
rect = stringbox( Handle )

引数

rect

バウンディングボックスの4頂点の座標を有する2x4 行列.

string

囲われる文字列行列.

x,y

実数スカラー, 文字列の左下の座標.

angle

文字列の点(x,y)を中心とする時計回りの回転角(単位:度)

fonStyle

フォントの型を指定する整数.

fontSize

フォントの大きさを指定する整数.

Handle

Textまたは Label型のグラフィックハンドル.

説明

stringbox はtextまたはlabelオブジェクトまたは 特定の手段で表示される文字列を囲う矩形の頂点を返します. 座標はカレントのグラフィックスケールで指定されます. 最初の頂点はテキストの座標 (x,y)の 回転しない状態で左下の点に対応し, 以下の頂点は時計回りに戻り値の行列に指定されます.

結果は PostScriptドライバに指定するにはあまり正確ではない可能性があります.

// 軸を表示
axes = gca() ;
axes.axes_visible = 'on' ;
axes.data_bounds = [ 1, 1 ; 10, 10 ] ;

// 軸にラベルを表示
xtitle( 'stringbox', 'X', 'Y' )  ;

// Xラベルのバウンディングボックスを取得
stringbox( axes.x_label )

// 文字列を描画
str = [ "Scilab", "is" , "not", "Skylab" ] ;
xstring( 4, 9, str ) ;

//テキストを修正
e = gce() ;
e.font_angle = 90 ;
e.font_size    = 6  ;
e.font_style   = 7 ;
e.box = 'on' ;

// バウンディングボックスを取得
stringbox( e )
// または
rect = stringbox( str, 4, 9, 90, 7, 6 )

// クリックし,テキストがヒットしたかどうかを確認
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 — 文字列をボックス内に描画
Report an issue
<< Math rendering in Scilab graphics text text_properties >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Apr 02 17:37:33 CEST 2013