Interface ITextStyleBuilder
interface ITextStyleBuilder
Extends com.amazon.apmf.IStandard
interface which builds the text styling object
Methods
color()
Sets the color of the text. The default color value is BLACK{0xFF, 0x00, 0x00, 0x00} .voidcolor(Color*color)
Parameters
color
Color* — Required
Color object representing the desired text color.
backgroundColor()
Sets the background color for text. Background color does not have a default value. When no background color is set, text is drawn without a background.voidbackgroundColor(Color*bgColor)
Parameters
bgColor
Color* — Required
Color object representing the desired text background color.
fontSize()
Sets the size of the font to be used for rendering text. The default font size value is 14.0f.voidfontSize(floatfontSize)
Parameters
fontSize
float — Required
The desired font size as a float value.
Note: The font size is specified in absolute points on the screen.
Throws
InvalidArgumentError— If a negative or zero font size value is passed.
fontScale()
Sets the font scale for the text. The font scale factor represents the adjustment applied to the font size. The default font scale value is 1.0f.voidfontScale(floatfontScale)
Parameters
fontScale
float — Required
The desired font scale as a float value.
Note: Font scale is a scaling factor or multiplier.
For example, a font scale of 1.0 means no scaling (the original font size),
a scale of 0.5 would reduce the font size by half, and a scale of 2.0 would double the font size
Throws
InvalidArgumentError— If a negative or zero font scale value is passed.
fontStyle()
Sets the font style for the text using the provided IFontStyle object.voidfontStyle(IFontStyle*fontStyle)
Parameters
fontStyle
IFontStyle* — Required
An IFontStyle object representing the desired font style.
letterSpacing()
Sets the letter spacing property that adjusts the space between characters in a text element. The default letter spacing is 0.0f.voidletterSpacing(floatletterSpacing)
Parameters
letterSpacing
float — Required
The letter spacing in absolute point value.
Note: The letter spacing is specified in points, which are a physical measurement on the screen.
wordSpacing()
Sets the word spacing property that adjusts the space between words in a text element. The default word spacing is 0.0f.voidwordSpacing(floatwordSpacing)
Parameters
wordSpacing
float — Required
The word spacing in absolute point value.
Note: The word spacing is specified in points, which are a physical measurement on the screen.
lineHeight()
Sets the line height for the text as a multiplier of the font size. The default value is 0.0f, which indicates that no explicit line height has been set by the caller, and the rendering engine will fall back to the font’s intrinsic line height as defined by its font metrics.voidlineHeight(floatlineHeight)
Parameters
lineHeight
float — Required
The line height multiplier of the font size.
Throws
InvalidArgumentError— If a negative line height value is passed.
textDecoration()
Sets the text decoration to be applied on the text eg underline. The default decoration is none.voidtextDecoration(TextDecorationtextDecoration)
Parameters
textDecoration
TextDecoration — Required
The desired textDecoration value.
superscript()
Sets the superscript formatting for the text. Ifvoidsuperscript(boolsuperscript)
superscript is
true, the text will be formatted as superscript; otherwise, the formatting
will be disabled. By default, it is false.
Parameters
superscript
bool — Required
true to enable superscript formatting, false to disable it.
subscript()
Sets the subscript formatting for the text. Ifvoidsubscript(boolsubscript)
subscript is
true, the text will be formatted as subscript; otherwise, the formatting
will be disabled. By default, it is false.
Parameters
subscript
bool — Required
true to enable subscript formatting, false to disable it.
textDecorationStyle()
Sets the styling for text line decoration. The default decoration style is SOLID. In case of no line decoration, this styling will be no-operation.voidtextDecorationStyle(TextDecorationStyletextDecorationStyle)
Parameters
textDecorationStyle
TextDecorationStyle — Required
The text decoration style to set. Use one of the values from the TextDecorationStyle enum.
fontFamilies()
Sets the font families for the text style to be used in rendering text.voidfontFamilies(string[]fontFamilies)
Parameters
fontFamilies
string[] — Required
An array of font family names.
Note: Default font family i.e. sans-serif will be used in case of empty or none font-family array value.
font()
Adds the font for rendering text. Users can also specify font families using thevoidfont(IFont*font)
ITextStyleBuilder::fontFamilies.
If font families are already set, the specified font will be appended to the list.
Parameters
font
IFont* — Required
An IFont instance.
build()
Creates the instance of ITextStyleITextStyle*build()
Returns
ITextStyle*
The new ITextStyle instance.

