Typography
La tipografía está definida según los estandares de material design.
info
Toda fuente de texto en componentes de agave usan Barlow
.
- XML
- Jetpack Compose
Tenemos fuentes personalizadas siguiendo la escala de tipos de material design (Type Scale).
Type scale | Name style XML | Font | Text Size |
---|---|---|---|
H1 | h1 | Barlow Bold | 75 sp |
H2 | h2 | Barlow Light | 60 sp |
H3 | h3 | Barlow Regular | 45 sp |
H4 | h4 | Barlow Bold | 35 sp |
H5 | h5 | Barlow Bold | 24 sp |
H6 | h6 | Barlow Bold | 19 sp |
Subtitle 1 | subtitle1 | Barlow Medium | 24 sp |
Subtitle 2 | subtitle2 | Barlow Semibold | 19 sp |
Body 1 | body1 | Barlow Semibold | 17 sp |
Button | button | Barlow Semibold | 16 sp |
Caption | caption | Barlow Regular | 12 sp |
Overline | overline | Barlow Regular | 16 sp |
El modo de uso es muy sencillo, se basa en definir un Name style Android en el atributo style de cualquier texto, el color de texto lo defines tú.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h1"
android:textColor="@color/primary500"
android:text="Headline 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h2"
android:textColor="@color/primary500"
android:text="Headline2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h3"
android:textColor="@color/primary500"
android:text="Headline 3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h4"
android:textColor="@color/primary500"
android:text="Headline 4"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h5"
android:textColor="@color/primary500"
android:text="Headline 5"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/h6"
android:textColor="@color/primary500"
android:text="Headline 6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/subtitle1"
android:textColor="@color/primary500"
android:text="Subtitle 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/subtitle2"
android:textColor="@color/primary500"
android:text="Subtitle 2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/body1"
android:textColor="@color/primary500"
android:text="Body 1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/button"
android:textColor="@color/primary500"
android:text="Button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/caption"
android:textColor="@color/primary500"
android:text="Caption"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/overline"
android:textColor="@color/primary500"
android:text="Overline"/>

Utilizar la tipografía nunca fue tan fácil, solo necesita ubicar la variable Typography de la librería de agave y decidir q Type Scale deseas utilizar, las dimensiones son las mismas que lo definido en XML, la lista se muestra a continuación:
Type scale | Name style Jetpack Compose | Font | Text Size |
---|---|---|---|
H1 | h1 | Barlow Bold | 75 sp |
H2 | h2 | Barlow Light | 60 sp |
H3 | h3 | Barlow Regular | 45 sp |
H4 | h4 | Barlow Bold | 35 sp |
H5 | h5 | Barlow Bold | 24 sp |
H6 | h6 | Barlow Bold | 19 sp |
Subtitle 1 | subtitle1 | Barlow Medium | 24 sp |
Subtitle 2 | subtitle2 | Barlow Semibold | 19 sp |
Body 1 | body1 | Barlow Semibold | 17 sp |
Button | button | Barlow Semibold | 16 sp |
Caption | caption | Barlow Regular | 12 sp |
Overline | overline | Barlow Regular | 16 sp |
El siguiente ejemplo muestra el uso de un h4, h5, h6 y button
Text(text = "Typography h4", color = Primary500, style = Typography.h4)
Text(text = "Typography h5", color = Primary500, style = Typography.h5)
Text(text = "Typography h6", color = Primary500, style = Typography.h6)
Text(text = "Typography button", color = Primary500, style = Typography.button)
El resultado luciría así:
