Search code examples
iosxamarin.formsgoogle-font-apiroboto

Xamarin forms iOS apply same font but different style


I have a xamarin forms app. I want to make use of Roboto Font Family, from Google Fonts. Actually, Roboto Light and Roboto Regular. What's the name for Roboto Light and Roboto Regular for iOS?

<OnPlatform x:Key="RobotoLightFontFamily" x:TypeArguments="x:String">
    <On Platform="UWP" Value="/Assets/Fonts/Roboto-Light.ttf#Roboto" />
    <On Platform="iOS" Value="Roboto Light" />
    <On Platform="Android" Value="Roboto-Light.ttf#Roboto" />
</OnPlatform>
<OnPlatform x:Key="RobotoRegularFontFamily" x:TypeArguments="x:String">
    <On Platform="UWP" Value="/Assets/Fonts/Roboto-Regular.ttf#Roboto" />
    <On Platform="iOS" Value="Roboto" />
    <On Platform="Android" Value="Roboto-Regular.ttf#Roboto" />
</OnPlatform>

It does not work like this... It only applies one font instead of both when using each font family foreach component


Solution

  • After some tries, naming it Roboto-Light works.