# LayoutElementBuilders.FontStyle

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/LayoutElementBuilders.java+class:androidx.wear.protolayout.LayoutElementBuilders.FontStyle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


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

<br />

*** ** * ** ***

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

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle` |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 400) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#ROBOTO_FLEX_FONT() = "roboto-flex"` Font family name that uses Roboto Flex variable font. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 400) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#ROBOTO_FONT() = "roboto"` Font family name that uses Roboto font. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.ColorProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getColor()()` Gets the text color. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/TypeBuilders.BoolProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getItalic()()` Gets whether the text should be rendered in a italic typeface. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.EmProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getLetterSpacing()()` Gets the text letter-spacing. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getPreferredFontFamilies()()` Gets the prioritized collection of font family names describing which font should be used for this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle` and its fallback values if not available. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontSetting>` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getSettings()()` Gets the collection of font settings to be applied. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getSize()()` Gets the size of the font, in scaled pixels (sp). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpProp>` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/ProtoLayoutExperimental https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getSizes()()` Gets the available sizes of the font, in scaled pixels (sp). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/TypeBuilders.BoolProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getUnderline()()` Gets whether the text should be rendered with an underline. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontVariantProp` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/ProtoLayoutExperimental https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getVariant()()` Gets the variant of a font. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontWeightProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#getWeight()()` Gets the weight of the font. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.FontStyle#toString()()` |

## Constants

### ROBOTO_FLEX_FONT

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)

```
@RequiresSchemaVersion(major = 1, minor = 400)
public static final String ROBOTO_FLEX_FONT = "roboto-flex"
```

Font family name that uses Roboto Flex variable font. Supported in renderers supporting 1.4, but the actual availability of this font is dependent on the devices.

### ROBOTO_FONT

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)

```
@RequiresSchemaVersion(major = 1, minor = 400)
public static final String ROBOTO_FONT = "roboto"
```

Font family name that uses Roboto font. Supported in renderers supporting 1.4, but the actual availability of this font is dependent on the devices.

## Public methods

### getColor

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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.

### getPreferredFontFamilies

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)

```
public @NonNull List<String> getPreferredFontFamilies()
```

Gets the prioritized collection of font family names describing which font should be used for this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)

```
public @NonNull List<LayoutElementBuilders.FontSetting> getSettings()
```

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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)

```
@ProtoLayoutExperimental
public @NonNull List<DimensionBuilders.SpProp> getSizes()
```

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

### getUnderline

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#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()
```