Product Documentation
Cadence User Interface SKILL Reference
Product Version IC23.1, September 2023

hiGetTextWidth

hiGetTextWidth(
S_fontType 
t_text 
) 
=> x_width / -1

Description

Returns the width, in pixels, of a string of characters that has a specified font.

This value is useful when creating two-dimensional forms.

Arguments

S_fontType

Type of the font you want to use.
Valid values: "text", 'text, "label", or 'label.

text: The font used in CIW, Encapsulation output windows, viewfiles, and the input area of text fields.

label: The font used in banner labels, menus, and forms.

t_text

A character string to return the width.

Values Returned

x_width

The width of the string, in pixels.

-1

t_fontType is not a valid font.

Unlike the hiGetTextWidth function, if an invalid font is specified in the hiTextWidth function, then the return value is nil.

Examples

hiGetTextWidth( 'text "This is a string." )
=> 119
hiGetTextWidth( "label" "This is a string." )
=> 84
hiGetTextWidth( "notafont" "This is a string." )
=> *WARNING* hiiGetTextWidth: Invalid font type "notafont", must be "text" or "label".
-1

Related Topics

Text Attribute Functions

hiTextWidth


Return to top
 ⠀
X