LayoutElementBuilders.FontStyle


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


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

Summary

Nested types

Builder for FontStyle

Public methods

@Nullable ColorBuilders.ColorProp

Gets the text color.

@Nullable TypeBuilders.BoolProp

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

@Nullable DimensionBuilders.EmProp

Gets the text letter-spacing.

@Nullable DimensionBuilders.SpProp

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

@NonNull List<DimensionBuilders.SpProp>

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

@Nullable TypeBuilders.BoolProp

Gets whether the text should be rendered with an underline.

@Nullable LayoutElementBuilders.FontVariantProp

Gets the variant of a font.

@Nullable LayoutElementBuilders.FontWeightProp

Gets the weight of the font.

@NonNull String

Public methods

getColor

Added in 1.0.0
public @Nullable ColorBuilders.ColorProp getColor()

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
public @Nullable TypeBuilders.BoolProp getItalic()

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

getLetterSpacing

Added in 1.0.0
public @Nullable DimensionBuilders.EmProp getLetterSpacing()

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

getSize

Added in 1.0.0
public @Nullable DimensionBuilders.SpProp getSize()

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
public @NonNull List<DimensionBuilders.SpPropgetSizes()

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

getUnderline

Added in 1.0.0
public @Nullable TypeBuilders.BoolProp getUnderline()

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

getVariant

Added in 1.0.0
@ProtoLayoutExperimental
public @Nullable LayoutElementBuilders.FontVariantProp getVariant()

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
public @Nullable LayoutElementBuilders.FontWeightProp getWeight()

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

public @NonNull String toString()