Search code examples
windows-phone-8.1windows-8.1ui-design

Custom font on Windows 8.1 Universal


I want to use a custom font on Windows 8.1 universal app.
I search a little to understand how can I do that. I do that in this way:
1) import ttf font to my app.
2) set build action to Content.
3) use that in my control: FontFamily="/Fonts/meteocons.ttf#Meteocons" But this is not work for me! Is it possible to help me?
Thanks.


Solution

  • Valid schema for FontFamily looks like:

    FontFamily="FONT_FILE_PATH#FONT_NAME"

    FONT_NAME is real name of font (you can find it, in font previewer)

    Check if you have a valid path and name(maybe you have some unnecessary slashes or not full path), because it should works, and it works very well for me.

    <TextBlock Text="CustomFontem" FontFamily="Assets/Garfield.ttf#Garfield Hates Mondays Loves Fonts" FontSize="64"/>
    

    You can also change font file Copy To Output Directory option to Copy always.