https://kotlinlang.org logo
#compose
Title
# compose
s

Stylianos Gakis

03/24/2023, 12:28 PM
For Material3 typography, when trying to dig into what is the default font style used, I see this line which simply says that the default is
TextStyle()
which internally does not specify the font size and so on, they are set as
TextUnit.Unspecified
. How do I know which typography value from the material3 typography is used by default if I simply call
material3.Text("blahblah")
without specifying the text myself? I know if I am in a contained which internally has set
ProvideTextStyle
it will be that, but what if I am not inside such a contained which has set that composition local? Couldn’t find anything in the m3 docs either for this.
Oh nvm, I can see it is setup here inside the MaterialTheme() composable itself, so if I am inside one of those (is always the case anyway unless in a contained as I mentioned above) then I know it’s
bodyLarge
.
h

Halil Ozercan

03/24/2023, 12:35 PM
And if you are in none of these containers that set LocalTextStyle, BasicText will finally call resolveDefaults before starting text layout which will use
14.sp
s

Stylianos Gakis

03/24/2023, 12:36 PM
Ah I did not know that, thanks for the clarification! Where is this resolved in the code? I was trying to navigate myself through the code in cs.android.com but failed to find this thing that you are mentioning tbh.
17 Views