Vivek Modi
Vivek Modi

Reputation: 7161

Custom Font weight in jetpack compose

my designer give me

Font(R.font.source_sans_variable_350)

which is 350. I am working on fonts through this doc. To provide FontWeight in FontFamily. I checked FontWeight.Light and FontWeight.Normal which is 300 and 400 respectively. So is there any solution for 350 ?

Thanks

Upvotes: 0

Views: 2065

Answers (2)

Bhavin Solanki
Bhavin Solanki

Reputation: 510

I am not sure but check this(may be related to this). to your style file

<family name="sans-serif">
     <font weight="300" style="normal">sans_light.Light.ttf</font>
     <font weight="350" style="normal">sans_medium.ttf</font>
     <font weight="400" style="normal">sans_normal.ttf</font>
</family>

Upvotes: 0

SpiritCrusher
SpiritCrusher

Reputation: 21043

Its a class with parameterized constructor . You can just use it like this .

Font(resId = R.font.montserrat_light, weight = FontWeight(350))

Upvotes: 1

Related Questions