Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom font usage in Windows Phone 8

I have a weird problem with the Windows Phone 8 emulator! I have a small test app where I change the 'page name' textbox on the mainpage so that it shows using a custom font. Now in the visual studio designer I see that font and when running the app I also see it in the emulator, so all is well...

But when I move the main page into a folder called View and change the WMAppManifest.xml to reflect this move > Navigation page is now set to View/MainPage.xaml. I'm still seeing this custom font in my designer, but not anymore in the emulator!!

I don't own a wp8 device yet... so can anyone verify this for me, if this problem is the same when you try to deploy the failure project to the phone?

And does anybody have any clue why this is happening? Very annoying not able to see the correct design in the emulator.

Working and failing projects

like image 933
Depechie Avatar asked Dec 29 '12 20:12

Depechie


2 Answers

Ok found the solution myself... it's because of the reference to the font inside the styles.xaml.

It should be a full path! So instead of setting:

<Setter Property="FontFamily" Value="Fonts/ClementePDae-Light.ttf#ClementePDae" />

Set this:

<Setter Property="FontFamily" Value="/PhoneApp1;component/Fonts/ClementePDae-Light.ttf#ClementePDae" />

Than everything works!

like image 163
Depechie Avatar answered Nov 09 '22 14:11

Depechie


I hope you found the solution already. Please check out How to add Custom Fonts

This worked for me on Windows Phone 8 (Lumia 920)
It is very important to hashtag the font name after the .ttf
You can find the font name if you preview the ttf file on your PC and write the exact same font name.

like image 33
user2036611 Avatar answered Nov 09 '22 15:11

user2036611