Typography
On this page
Specifications references
Implementation in Jetpack Compose
As ODS library supports multi-theme, the available typography is managed by a class (OdsTypography) which is instantiated by the theme itself. It has a default constructor with the values used by Orange.
The theme provides typography for the application which uses the ODS library. ODS library components relies on the OdsTypography defined by the used theme.
Through the OdsTypography class, you can set the fontFamily which will be applied to the typography text styles and you can define text styles you want to be in capitals by adding it into the allCapsTextStyles list.
We recommend you to use OdsText composable and provide an OdsTextStyle to display texts:
OdsText(
text = "Hello",
style = OdsTextStyle.BodyL,
)
However, you can directly use ODS typography in a Text composable as shown below:
Text(
text = "Hello",
style = OdsTheme.typography.bodyL,
)
OdsText composable
ODS library also provides OdsText composable which is here to simplify the code you write.
The two differences between OdsText and Text are:
OdsTextuses theme text colors automatically taking into account the parameters provided like theenabledone,OdsTexttakes directly anOdsTextSyleas parameter and manage all caps text style if needed (anOdsTextStylecan be set all caps in theOdsTypographyof the theme).
Example of use:
OdsText(
text = "Big title",
style = OdsTextStyle.HeadlineL
)