Class: TextSupport

TextSupport()

Provides methods useful for displaying text. An instance of this class is attached to the WorldWindow DrawContext and is not intended to be used independently of that. Applications typically do not create instances of this class.

Constructor

new TextSupport()

Constructs a TextSupport instance.
Source:

Methods

createTexture(dc, text, font, outline) → {Texture}

Creates a texture for a specified text string, a specified font and an optional outline.
Parameters:
Name Type Description
dc DrawContext The current draw context.
text String The text string.
font Font The font to use.
outline Boolean Indicates whether the text is drawn with a thin black outline.
Source:
Returns:
A texture for the specified text string and font.
Type
Texture

getMaxLineHeight(font) → {Vec2}

Calculates maximum line height based on a font
Parameters:
Name Type Description
font Font The font to use.
Source:
Returns:
A vector indicating the text's width and height, respectively, in pixels based on the passed font.
Type
Vec2

textSize(text, font, outline) → {Vec2}

Returns the width and height of a specified text string upon applying a specified font and optional outline.
Parameters:
Name Type Description
text string The text string.
font Font The font to apply when drawing the text.
outline Boolean Indicates whether the text includes an outline, which increases its width and height.
Source:
Returns:
A vector indicating the text's width and height, respectively, in pixels.
Type
Vec2

wrap(text, width, height, font) → {String}

Wraps the text based on width and height using new linew delimiter
Parameters:
Name Type Description
text String The text to wrap.
width Number The width in pixels.
height Number The height in pixels.
font Font The font to use.
Source:
Returns:
The wrapped text.
Type
String

wrapLine(text, width, font) → {String}

Wraps a line of text based on width and height
Parameters:
Name Type Description
text String The text to wrap.
width Number The width in pixels.
font Font The font to use.
Source:
Returns:
The wrapped text.
Type
String