I have multiple .ttf file from the same family, like:
MyFont.ttf
MyFont_Bold.ttf
MyFont_Light.ttf
MyFont_Medium.ttf
If I want to use each weight, I should define theme as separate FontFamily like this:
<FontFamily x:Key="MyFont">
ms-appx:///Fonts/MyFont.ttf#MyFont
</FontFamily>
<FontFamily x:Key="MyFont_Bold">
ms-appx:///Fonts/MyFont_Bold.ttf#MyFont
</FontFamily>
<FontFamily x:Key="MyFont_Light">
ms-appx:///Fonts/MyFont_Light.ttf#MyFont
</FontFamily>
<FontFamily x:Key="MyFont_Medium">
ms-appx:///Fonts/MyFont_Medium.ttf#MyFont
</FontFamily>
And use them like:
<TextBlock FontFamily="{StaticResource MyFont}" />
<TextBlock FontFamily="{StaticResource MyFont_Bold}" />
<TextBlock FontFamily="{StaticResource MyFont_Light}" />
<TextBlock FontFamily="{StaticResource MyFont_Medium}" />
Is there any way to use theme like this:
<TextBlock FontFamily="{StaticResource MyFont}" />
<TextBlock FontFamily="{StaticResource MyFont}" FontWeight="Bold" />
<TextBlock FontFamily="{StaticResource MyFont}" FontWeight="Light" />
<TextBlock FontFamily="{StaticResource MyFont}" FontWeight="Medium" />