Provides rendering instructions for a specific text element.
Introduced in Wear OS 4.
Syntax
<Font family="string | SYNC_TO_DEVICE" size="float" color="argb-color | rgb-color" slant="NORMAL | ITALIC" letterSpacing="em-value" width="ULTRA_CONDENSED | EXTRA_CONDENSED | CONDENSED | SEMI_CONDENSED | NORMAL | SEMI_EXPANDED | EXPANDED | EXTRA_EXPANDED | ULTRA_EXPANDED" weight="THIN | ULTRA_LIGHT | EXTRA_LIGHT | LIGHT | NORMAL | MEDIUM | BOLD | SEMI_BOLD | ULTRA_BOLD | EXTRA_BOLD | BLACK | EXTRA_BLACK"> <!-- Inner elements consist of text decoration and text formatting options. Here, "Lower" is used as an example. --> <Lower ... /> </Font>
Attributes
The Font element has the following attributes. Some attributes are
required while others are optional.
Required attributes
The following attributes are required:
- family
- The name of the font used for rendering the text. To use the same font family as the system, set this value to - SYNC_TO_DEVICE.
- To use a custom font, place the font file in - res/font/, using one of the following accepted font file extensions: TTF, OTF, TTC, or XML. Then, set this value to the name of the font file, excluding the extension at the end.
- If the font file cannot be resolved, the system font is used. 
- size
- A floating-point value that specifies the text size. 
Optional attributes
The following attributes are optional:
- color
- The color of the text. If provided, you must specify the color using either the ARGB format ( - #ff000000= opaque black) or the RGB format (- #000000= black).- From version 4, this attribute is transformable. 
- letterSpacing
- The space between letters, specified in EM units. The default value is 0. An example for slight expansion could be 0.05. Negative values tighten text. 
- slant
- Whether to use a - NORMALfont slant (default) or an- ITALICslant.
- width
- An enumeration of several hints for a font family variant to use. The default value is - NORMAL, which applies the "normal" variant of the font.- The following list contains the other enumeration values and the respective font family variants that they use, if that variant is available for the font: - ULTRA_CONDENSEDand- EXTRA_CONDENSEDuse the "condensed-light" variant.
- CONDENSEDuses the "condensed" variant.
- SEMI_CONDENSEDuses the "condensed-medium" variant.
- SEMI_EXPANDED,- EXPANDED,- EXTRA_EXPANDED, and- ULTRA_EXPANDEDeach use the "normal" variant.
 
- weight
- An enumeration of several possible font weights. The default value is - NORMAL, which applies a weight of- 400.- The following list contains the other enumeration values and their respective font weights: - THINuses a font weight of- 100.
- ULTRA_LIGHTuses a font weight of- 150.
- EXTRA_LIGHTuses a font weight of- 200.
- LIGHTuses a font weight of- 300.
- MEDIUMuses a font weight of- 500.
- SEMI_BOLDuses a font weight of- 600.
- ULTRA_BOLDuses a font weight of- 750.
- EXTRA_BOLDuses a font weight of- 800.
- BLACKuses a font weight of- 900.
- EXTRA_BLACKuses a font weight of- 1000.
 
Inner elements
The Font element can contain the following inner elements:
