0
votes

I'm trying to set custom font family using CSS file in Xamarin forms project. I placed the respective font in the android and ios project (Assets/Bodoni.ttf for android) and (Resources/Bodoni.tff for IOS)

and declared the class in the css file

.titleLabel {
    font-family: Bodoni;
    color: #960051;
}

The css file is well interpreted and my element (Label) contains the styleClass attribute with the value from above. The color property works well but the font family does not change.

Are there any other manipulations to do to integrate my custom font ?

1

1 Answers

0
votes

All CSS files in the shared project needs to target its BuildAction as EmbeddedResource.

As well any specific platform resource needs to have its BuildAction set as:

  • iOS: BundleResource
  • Android: AndroidResource

Your problem could be more related to the second paragraph, since the first one will throw an exception otherwise.