https://kotlinlang.org logo
Title
t

Tgo1014

12/14/2021, 8:39 AM
Is there a way to set the default font family or I’ve to override in all “styles” (body1, h1, etc)?
f

Florian

12/14/2021, 8:52 AM
t

Tgo1014

12/14/2021, 9:03 AM
hmmm, this doesn’t show up for me in the
Typography
from Material3 😕
s

Sean McQuillan [G]

12/14/2021, 8:52 PM
@matvei
m

matvei

12/15/2021, 11:23 AM
Hello 🙂 Typography exists in material3, but it has different semantical values, there's no more h1-h6 and similar, but stuff like
bodySmall
,
bodyLarge
. I'm not sure there's a public documentation representing this though @Nick Rout But you can find the definition here: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]androidx/compose/material3/Typography.kt;l=75?q=Typography.kt
t

Tgo1014

12/15/2021, 11:37 AM
@matvei thanks for the info, but that’s not really the question 😅 the questions is how to set the same font family for everything at once. In the Material2 version there’s a
defaultFontFamily
parameter in the
Typography
class that doesn’t exists in the Material3 version of it.
m

matvei

12/15/2021, 11:43 AM
Oh, I see 🙂 Yeah that a good question, I will let Nick to chime in
n

Nick Rout

12/15/2021, 11:47 AM
But yeah, there's currently no
defaultFontFamily
in M3 Typography. Not entirely sure why to be honest but it sounds like a good feature request
t

Tgo1014

12/15/2021, 12:00 PM
Also right now I couldn’t find a way to “copy” the default implementation for each (titleLarge, titleMedium, etc) and just replace the font family, so basically I would have to create every component of the style just to replace the font 😕
n

Nick Rout

12/15/2021, 12:03 PM
Yeah, but you could probably get away with overriding only the styles your app uses
👍🏽 1
But I agree it would be nice to have a default