get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtentsget_string_extents (Operator)
Name
get_string_extentsT_get_string_extentsGetStringExtentsGetStringExtentsget_string_extents
— Get the spatial size of a string.
Signature
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)
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]]
Description
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsget_string_extents
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_extentsGetStringExtentsGetStringExtentsget_string_extents
, 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_stringWriteStringWriteStringwrite_string
.
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
WindowHandleWindowHandleWindowHandlewindowHandlewindow_handle
(input_control) window →
HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Window handle.
ValuesValuesValuesvaluesvalues
(input_control) string(-array) →
HTupleMaybeSequence[Union[str, float, int]]HTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)
Values to consider.
Default:
'test_string'
"test_string"
"test_string"
"test_string"
"test_string"
AscentAscentAscentascentascent
(output_control) extent.y →
HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Maximum height above baseline.
DescentDescentDescentdescentdescent
(output_control) extent.y →
HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Maximum extension below baseline.
WidthWidthWidthwidthwidth
(output_control) extent.x →
HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Text width.
HeightHeightHeightheightheight
(output_control) extent.y →
HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)
Text height.
Result
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsget_string_extents
returns 2 (
H_MSG_TRUE)
if the window is valid.
Otherwise an exception is raised.
Possible Predecessors
open_windowopen_windowOpenWindowOpenWindowopen_window
,
set_fontset_fontSetFontSetFontset_font
Possible Successors
set_tpositionset_tpositionSetTpositionSetTpositionset_tposition
,
write_stringwrite_stringWriteStringWriteStringwrite_string
,
read_stringread_stringReadStringReadStringread_string
,
read_charread_charReadCharReadCharread_char
See also
get_font_extentsget_font_extentsGetFontExtentsGetFontExtentsget_font_extents
,
set_tpositionset_tpositionSetTpositionSetTpositionset_tposition
,
set_fontset_fontSetFontSetFontset_font
Module
Foundation