Xamarin CSS lets you specify a font-family
using a syntax similar to CSS. I need to set a custom font. Usually that looks like this:
<Style x:Key="RockwellFontLabel" TargetType="Label">
<Setter Property="FontFamily">
<OnPlatform x:TypeArguments="x:String">
<On Platform="Android" Value="RockwellStd.otf#RockwellStd.otf" />
<On Platform="iOS" Value="RockwellStd" />
</OnPlatform>
</Setter>
</Style>
...
<Label Style="{StaticResource RockwellFontLabel}" Text="I AM TEXT"/>
Which, while verbose, does work. But Xamarin CSS promises so much more. I can do things like set the font family for a whole section with just one "CSS" rule, right? RIGHT?!
#myElement * {
font-family: 'RockwellStd';
color: hotpink;
}
But that only sets the color. It doesn't set my custom font family at all. Obviously on Android the font is located under /Assets/RockwellStd.otf
with a Build Action set to AndroidAsset
and /Resources/Fonts/RockwellStd.otf
with a build action of BundleResource
.
Is it possible to use a custom font with Xamarin CSS? If so, how?