Skip to content

get_string_extentsGetStringExtentsGetStringExtentsget_string_extentsT_get_string_extents🔗

Short description🔗

get_string_extentsGetStringExtentsGetStringExtentsget_string_extentsT_get_string_extents — Get the spatial size of a string.

Signature🔗

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 )

Description🔗

get_string_extentsGetStringExtents queries width and height of the output size of a string using the font of the window. Thereby strings with multiple lines are treated as if concatenated into a single line. In addition, the extension above and below the baseline is returned (Ascentascentascent and Descentdescentdescent, respectively).

The sizes are measured in the coordinate system of the window (for text windows in pixels). Using get_string_extentsGetStringExtents, it is possible to determine text output and input independently from the used font. The conversion from integer numbers and floating point numbers to text strings is the same as in write_stringWriteString.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

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

Window 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)

Values to consider.

Default: 'test_string'"test_string"

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

Maximum height above baseline.

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

Maximum extension below baseline.

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

Text width.

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

Text height.

Result🔗

get_string_extentsGetStringExtents returns 2 (H_MSG_TRUE) if the window is valid. Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

open_windowOpenWindow, set_fontSetFont

Possible successors

set_tpositionSetTposition, write_stringWriteString, read_stringReadString, read_charReadChar

See also

get_font_extentsGetFontExtents, set_tpositionSetTposition, set_fontSetFont

Module🔗

Foundation