Home > OS >  Custom Font weight in jetpack compose
Custom Font weight in jetpack compose

Time:08-05

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

CodePudding user response:

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

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

CodePudding user response:

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>
  • Related