Using OTF fonts in a Windows 10 (WinRT) app

Universal windows 10 apps support OTF fonts but to use them you might have to change the generated XAML a bit.

This tutorial uses the beautiful Edmondsans font, created by James T.Edmondson, to demonstrate how to use OTF fonts in WinRT.

edmondsans

project

Open the font to inspect the Font name (Edmondsans Regular):

font info

XAML like this is created:

FontFamily="Edmondsans-Regular.otf#Edmondsans Regular"

Which strangely results in text rendered with the system font:

segoe

How to show the proper OTF font?

FontFamily="Edmondsans-Regular.otf#Edmondsans"

edmond

And this is how to show Edmond sans in regular, medium and bold weight:

<TextBlock Text="Edmondsans Regular" FontFamily="Edmondsans-Regular.otf#Edmondsans" />
<TextBlock Text="Edmondsans Medium" FontFamily="/Edmondsans-Medium.otf#Edmondsans" />
<TextBlock Text="Edmondsans Bold" FontFamily="/Edmondsans-Bold.otf#Edmondsans" />

all weights