LayoutElementBuilders.FontStyle


@RequiresSchemaVersion(major = 1, minor = 0)
class LayoutElementBuilders.FontStyle


The styling of a font (e.g. font size, and metrics).

Summary

Nested types

Builder for FontStyle

Constants

const String!
@RequiresSchemaVersion(major = 1, minor = 400)
DEFAULT_SYSTEM_FONT = "default"

Font family name that uses default system font.

const String!
@RequiresSchemaVersion(major = 1, minor = 400)
ROBOTO_FLEX_FONT = "roboto-flex"

Font family name that uses Roboto Flex variable font.

const String!
@RequiresSchemaVersion(major = 1, minor = 400)
ROBOTO_FONT = "roboto"

Font family name that uses Roboto font.

Public functions

ColorBuilders.ColorProp?

Gets the text color.

TypeBuilders.BoolProp?

Gets whether the text should be rendered in a italic typeface.

DimensionBuilders.EmProp?

Gets the text letter-spacing.

(Mutable)List<String!>

Gets the prioritized collection of font family names describing which font should be used for this FontStyle and its fallback values if not available.

(Mutable)List<LayoutElementBuilders.FontSetting!>

Gets the collection of font settings to be applied.

DimensionBuilders.SpProp?

Gets the size of the font, in scaled pixels (sp).

(Mutable)List<DimensionBuilders.SpProp!>

Gets the available sizes of the font, in scaled pixels (sp).

TypeBuilders.BoolProp?

Gets whether the text should be rendered with an underline.

LayoutElementBuilders.FontVariantProp?

Gets the variant of a font.

LayoutElementBuilders.FontWeightProp?

Gets the weight of the font.

String

Constants

DEFAULT_SYSTEM_FONT

Added in 1.2.0-alpha05
@RequiresSchemaVersion(major = 1, minor = 400)
const val DEFAULT_SYSTEM_FONT = "default": String!

Font family name that uses default system font. Supported in any renderer version.

ROBOTO_FLEX_FONT

Added in 1.2.0-alpha05
@RequiresSchemaVersion(major = 1, minor = 400)
const val ROBOTO_FLEX_FONT = "roboto-flex": String!

Font family name that uses Roboto Flex variable font. Supported in renderers supporting 1.4.

ROBOTO_FONT

Added in 1.2.0-alpha05
@RequiresSchemaVersion(major = 1, minor = 400)
const val ROBOTO_FONT = "roboto": String!

Font family name that uses Roboto font. Supported in renderers supporting 1.4.

Public functions

getColor

Added in 1.0.0
fun getColor(): ColorBuilders.ColorProp?

Gets the text color. If not defined, defaults to white.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

getItalic

Added in 1.0.0
fun getItalic(): TypeBuilders.BoolProp?

Gets whether the text should be rendered in a italic typeface. If not specified, defaults to "false".

getLetterSpacing

Added in 1.0.0
fun getLetterSpacing(): DimensionBuilders.EmProp?

Gets the text letter-spacing. Positive numbers increase the space between letters while negative numbers tighten the space. If not specified, defaults to 0.

getPreferredFontFamilies

Added in 1.2.0-alpha05
fun getPreferredFontFamilies(): (Mutable)List<String!>

Gets the prioritized collection of font family names describing which font should be used for this FontStyle and its fallback values if not available. For example, preferring default system variable font with default non variable system font as a fallback.

getSettings

Added in 1.2.0-alpha05
fun getSettings(): (Mutable)List<LayoutElementBuilders.FontSetting!>

Gets the collection of font settings to be applied.

Supported settings depend on the font used and renderer version.

getSize

Added in 1.0.0
fun getSize(): DimensionBuilders.SpProp?

Gets the size of the font, in scaled pixels (sp). If more than one size was originally added, it will return the last one.

getSizes

Added in 1.1.0
@ProtoLayoutExperimental
fun getSizes(): (Mutable)List<DimensionBuilders.SpProp!>

Gets the available sizes of the font, in scaled pixels (sp).

getUnderline

Added in 1.0.0
fun getUnderline(): TypeBuilders.BoolProp?

Gets whether the text should be rendered with an underline. If not specified, defaults to "false".

getVariant

Added in 1.0.0
@ProtoLayoutExperimental
fun getVariant(): LayoutElementBuilders.FontVariantProp?

Gets the variant of a font. Some renderers may use different fonts for title and body text, which can be selected using this field. If not specified, defaults to "body".

getWeight

Added in 1.0.0
fun getWeight(): LayoutElementBuilders.FontWeightProp?

Gets the weight of the font. If the provided value is not supported on a platform, the nearest supported value will be used. If not defined, or when set to an invalid value, defaults to "normal".

toString

fun toString(): String