Skip to content

get_string_extentsGetStringExtentsGetStringExtentsget_string_extentsT_get_string_extents🔗

説明🔗

get_string_extentsGetStringExtentsGetStringExtentsget_string_extentsT_get_string_extents — 文字列の空間サイズを取得する。

書式🔗

get_string_extents( window WindowHandle, string Values, out extent.y Ascent, out extent.y Descent, out extent.x Width, out extent.y Height )void GetStringExtents( const HTuple& WindowHandle, const HTuple& Values, HTuple* Ascent, HTuple* Descent, HTuple* Width, HTuple* Height )static void HOperatorSet.GetStringExtents( HTuple windowHandle, HTuple values, out HTuple ascent, out HTuple descent, out HTuple width, out HTuple height )def get_string_extents( window_handle: HHandle, values: MaybeSequence[Union[str, float, int]] ) -> Tuple[Union[int, float], Union[int, float], Union[int, float], Union[int, float]]

Herror T_get_string_extents( const Htuple WindowHandle, const Htuple Values, Htuple* Ascent, Htuple* Descent, Htuple* Width, Htuple* Height )

HTuple HWindow::GetStringExtents( const HTuple& Values, HTuple* Descent, HTuple* Width, HTuple* Height ) const

Hlong HWindow::GetStringExtents( const HString& Values, Hlong* Descent, Hlong* Width, Hlong* Height ) const

Hlong HWindow::GetStringExtents( const char* Values, Hlong* Descent, Hlong* Width, Hlong* Height ) const

Hlong HWindow::GetStringExtents( const wchar_t* Values, Hlong* Descent, Hlong* Width, Hlong* Height ) const (Windows only)

HTuple HWindow.GetStringExtents( HTuple values, out HTuple descent, out HTuple width, out HTuple height )

int HWindow.GetStringExtents( string values, out int descent, out int width, out int height )

説明🔗

get_string_extentsGetStringExtents は、ウインドウのフォントを使用した文字列の 出力サイズの幅と高さを問い合わせます。 これにより、複数行の文字列は、1行に連結されているかのように扱われます。 それに加えて、ベースラインの上下の拡張(Ascentascentascent と Descentdescentdescent)が返されます。

サイズは、(ピクセル単位で、テキストウインドウに対して)ウインドウの座標 システムの中で測定されます。get_string_extentsGetStringExtents を使用することで、 使用されたフォントからテキストの入出力を個別に決定することができます。 整数と浮動小数点数からテキスト文字列への変換は write_stringWriteString に おけるものと同じです。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

パラメーター🔗

WindowHandlewindowHandlewindow_handle (input_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

ウインドウハンドル

Valuesvaluesvalues (input_control) string(-array) → (string / real / integer)HTuple (HString / double / Hlong)HTuple (string / double / int / long)MaybeSequence[Union[str, float, int]]Htuple (char* / double / Hlong)

考慮される値

初期値: 'test_string'"test_string"

Ascentascentascent (output_control) extent.y → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

ベースラインより上の最大高さ

Descentdescentdescent (output_control) extent.y → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

ベースラインより下の最大拡張

Widthwidthwidth (output_control) extent.x → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

テキストの幅

Heightheightheight (output_control) extent.y → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

テキストの高さ

結果🔗

ウインドウが有効であるならば、get_string_extentsGetStringExtents は値 2 (H_MSG_TRUE) を 返します。そうでなければ、例外が発生します。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

open_windowOpenWindow, set_fontSetFont

後処理の候補

set_tpositionSetTposition, write_stringWriteString, read_stringReadString, read_charReadChar

関連項目

get_font_extentsGetFontExtents, set_tpositionSetTposition, set_fontSetFont

モジュール🔗

Foundation