get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtents (Operator)


get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtents — Get the spatial size of a string.


get_string_extents( : : WindowHandle, Values : Ascent, Descent, Width, Height)

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

void GetStringExtents(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)

static void HOperatorSet.GetStringExtents(HTuple windowHandle, HTuple values, out HTuple ascent, out HTuple descent, out HTuple width, out HTuple height)

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_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents 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 (AscentAscentAscentAscentascent and DescentDescentDescentDescentdescent, respectively).

The sizes are measured in the coordinate system of the window (for text windows in pixels). Using get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents, 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_stringwrite_stringWriteStringWriteStringWriteString.

Execution Information


WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

ValuesValuesValuesValuesvalues (input_control)  string(-array) HTupleHTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)

Values to consider.

Default value: 'test_string' "test_string" "test_string" "test_string" "test_string"

AscentAscentAscentAscentascent (output_control)  extent.y HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Maximum height above baseline.

DescentDescentDescentDescentdescent (output_control)  extent.y HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Maximum extension below baseline.

WidthWidthWidthWidthwidth (output_control)  extent.x HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Text width.

HeightHeightHeightHeightheight (output_control)  extent.y HTupleHTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Text height.


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

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowOpenWindow, set_fontset_fontSetFontSetFontSetFont

Possible Successors

set_tpositionset_tpositionSetTpositionSetTpositionSetTposition, write_stringwrite_stringWriteStringWriteStringWriteString, read_stringread_stringReadStringReadStringReadString, read_charread_charReadCharReadCharReadChar

See also

get_font_extentsget_font_extentsGetFontExtentsGetFontExtentsGetFontExtents, set_tpositionset_tpositionSetTpositionSetTpositionSetTposition, set_fontset_fontSetFontSetFontSetFont