Typography


Page Summary


Specifications references

Implementation

ODS library defines its own font style. The font associated to the style is defined in the theme set in the environment.

Apply font style on text

Apply the font style on text like this:

 Text("Sample").odsFont(.titleS)
 TextField("A text field", text: $textToEdit).odsFont(.titleS)

Apply font style on view

In the example below, the first text field has a font style set directly, while the font applied to the following container applies to all of the text views inside that container.

VStack {
    Text("Font applied to a text view.")
        .odsFont(.headlineL)

    VStack {
        Text("These two text views have the same font")
        Text("applied to their parent view.")
    }
    .odsFont(.titleS)
}