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

alexzhukovich

04/24/2020, 5:47 PM
I published an article about Themes and Typography in Jetpack Compose. I will be happy to hear a feedback and I hope it will be helpful https://alexzh.com/jetpack-compose-theme-and-typography/
👍 7
l

Louis Pullen-Freilich [G]

04/24/2020, 6:43 PM
Cool! I'm curious, is there a reason why
primary
in the dark theme is
1f1f1f
? I'm wondering what you use it for, as this seems atypical
a

alexzhukovich

04/24/2020, 8:59 PM
This color is used in one of example in material design guideline
s

Siyamed

04/28/2020, 5:43 AM
We have downloadable fonts in our plans. Not sure adding all Roboto fonts is the best option to go. Coincedentally i checked the size of all Roboto currently on Android which was 6mb, at least reminding this would be useful.
As far as i know currently Roboto is required for all OEMs to include in devices.
There is a possibility that this would change in platform based on the feedback but it should be the case for existing Android
a

alexzhukovich

05/15/2020, 5:25 AM
Thanks for sharing information about Roboto font
m

MBegemot

05/20/2020, 11:17 AM
Congratulations for your nice work! maybe you can help me to understand which is the meaning of font family when you write
Copy code
h1 = defaultTypography.h1.copy(fontFamily = appFontFamily)
then when you use Matherial.typografy.h1 in a text which of the family members will be applied? Thank you so much!
a

alexzhukovich

05/25/2020, 8:38 PM
Thank you for feedback. So, if you take a look at
defaultTypography
, you can find a a typography constructor which initialize Typography properties, like
h1
,
h2
,
h3
, etc.
Copy code
constructor(
        defaultFontFamily: FontFamily = FontFamily.Default,
        h1: TextStyle = TextStyle(
            fontWeight = FontWeight.Light,
            fontSize = 96.sp,
            letterSpacing = (-1.5).sp
        ),
        h2: TextStyle = TextStyle(
            fontWeight = FontWeight.Light,
            fontSize = 60.sp,
            letterSpacing = (-0.5).sp
        ),
        ...
)
As you can see every property is
TextStyle
and if we want to replace only
fontFamily
we need to use
copy
function
Every
TextStyle
has a
fontWeight
and it helps the framework to understand which fontStyle will be used. In case of
h1
we have the
val Light = W300
. Every font has a
weight
property:
Copy code
ResourceFont(
    resId = R.font.roboto_light,
    weight = FontWeight.W300,
    style = FontStyle.Normal
)
4 Views