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.



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:


How to show the proper OTF font?



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

GrĂ¼sse aus Berlin!
This is a cookie free and popup free website.
Join me in making the web enjoyable again by removing the need for annoying cookie warnings and silly newsletter overlays!