All TrueType Font(.TTF) files are not working RRS feed

  • Question

  • Hi,

    We are developing an windows phone silverlight application, Where I need to use external font styles in application. We have a requirement to load multiple TTF files.

    txtblk1.FontFamily = new System.Windows.Media.FontFamily("/CustomFonts/HelveticaNeueLTArabic-Bold.ttf#HelveticaNeueLT Arabic 75 Bold");
    txtblk2.FontFamily = new System.Windows.Media.FontFamily("/CustomFonts/HelveticaNeueLTStd-Bd.ttf#HelveticaNeueLT Std");

    Unfortunately the above code is not working for all TTF files.  We have created a sample demo application to understand issue easily.

    Please try to build & launch the application, then you will find some of font styles are not applied as below screenshot.

    Please suggest me to fix or find the issue?


    Do we have any specified custom fonts list in windows phone?


    Pallam Madhukar Windows Phone Developer

    Friday, August 21, 2015 1:06 PM

All replies

  • Hi Pallam Madhukar,

    I have tested your sample demo application, I guess there has something wrong with the .ttf files that not applied. I set FontFamily for the "txtblk1" as "LocalizaDINDisplay-Bold", it works fine. But when I set it as "HelveticaNebeLTArabic-Bold", it doesn't has any changes.

    As far as I know, "The displayed result is the best match based on the values of the FontFamily, FontStretch, FontStyle, and FontWeight properties. It is important to specify all four of these font properties to make sure that an accurate and consistent font selection is made for your text element". More information about the Fonts and FontFamily, you can refer to below links. Please check  the .ttf files that not applied whether there are not set one of these properties.

    Best Regards,

    Monday, August 24, 2015 5:16 AM
  • Hi Weiwei Cai,

    Thank you for replying. How can I figure out the problem in .ttf Files?

    After reading your reference links, I got more concept about how Text properties applied on TextBlock/TextBox/RichTextBox/PasswordBox, But Could not find way to go forward. Please can you provide some more references [OR] Any specific area I need to look?

    I have also cross checked the FontFamily applied or not like below:


    Please can you also confirm that "We don't have any limitations to load .TTF files".

    Your help greatly appreciated.


    Pallam Madhukar Windows Phone Developer

    • Edited by Pallam Madhukar Monday, August 24, 2015 6:10 AM corrected question format
    Monday, August 24, 2015 6:08 AM
  • It is too strange. When I run your sample code, there has any .ttf files don't be applied. So I use these .ttf files into a word document which is works fine.

    Then I check all font name of .ttf files, they are all correct. So it is not caused by error name.

    Based on the description of the first link that Weiwei provide, it says that "Windows Phone chooses the font from the supported local fonts, from the fonts provided in a packaged file referenced in the FontFamily property, or from the stream-based zip or .ttf file passed to the FontSourceproperty".

    Please try set the .ttf files to the FontSource property. This is my assumption.

    It is so weird!

    Tuesday, August 25, 2015 1:14 AM
  • It may be caused by the font encoding. WindowsPhone uses Unicode to represent characters. We recommend developing your app with Unicode encoding to ensure that your app can run in a global context. You can use the Encoding class to convert encodings from one Unicode type to another, for example, from UTF-8 to UTF-16.


    You also can use some third part tools to convert your TTF files. Please refer to below article. But it comes from a third part site. And I don't tested the solution with the third part tools. There may be inherent dangers, please make sure that you understand the risk before using the tools.


    • Edited by WilliamAAA Tuesday, August 25, 2015 9:18 AM
    Tuesday, August 25, 2015 9:17 AM
  • Hi Arno Liu,

    Thank you for your response. Can you please explain how font encoding can be an issue - as the same characters with different font style are working fine.  We request you to checkout the attached sample app and provide a solution or another approach if possible.

    Hi Weiwei Cai,

    We agree with your observation. We suspect that the issue may be specific to the TTF file. However, we have tried to identify the root cause to no avail. We have also tried different approaches mentioned in the following link: http://nicksnettravels.builttoroam.com/post/2013/06/22/TTF-Font-with-Windows-Phone-8.aspx -- but they haven't helped us. Please guide is in identifying the issue in TTF file.


    Pallam Madhukar Windows Phone Developer

    Thursday, August 27, 2015 12:48 PM
  • Hi Weiwei,

    We have same problem in windows 10 apps also. Please suggest any work-around.


    Pallam Madhukar Windows Phone Developer

    Friday, August 28, 2015 9:18 AM
  • Hi Pallam Madhukar,

    There are something wrong with the TTF files is my assumptions. I re-test your sample code again. I find that if I set the FontFamily with Properties window, it works fine. I compare with the FontFamily in XAML and in codebehind. The name is different as below shows. The line above is yours and the line next is generated by the Properties window. So the TTF fils are correct.

    //txtblk1.FontFamily = new FontFamily("CustomFonts/HelveticaNeueLTArabic-Bold.ttf#HelveticaNeueLT Arabic 75 Bold");
    txtblk1.FontFamily = new FontFamily("CustomFonts/HelveticaNeueLTArabic-Bold.ttf#Helvetica Neue LT Arabic");
    //txtblk2.FontFamily = new FontFamily("CustomFonts/HelveticaNeueLTStd-Bd.ttf#HelveticaNeueLT Std");
    txtblk2.FontFamily = new FontFamily("CustomFonts/HelveticaNeueLTStd-Bd.ttf#Helvetica Neue LT Std");

    Best Regards,

    Friday, August 28, 2015 1:06 PM
  • Hi Weiwei Cai,

    I have tried to follow your procedure:

    1. Select TextBlock, open Properties windows and change FontFamily by selecting from drop-down.

    2. I looked Xaml now, and found the generated  font name is same as code behind.

    Please can you tell me, How do I get name "CustomFonts/HelveticaNeueLTArabic-Bold.ttf#Helvetica Neue LT Arabic" for "CustomFonts/HelveticaNeueLTArabic-Bold.ttf#HelveticaNeueLT Arabic 75 Bold".


    Pallam Madhukar Windows Phone Developer

    Thursday, October 15, 2015 5:15 AM
  • Hi Weiwei Cai,

    We have observed that differences between windows phone 8.1 silverlight development & Windows Phone 8.1/Windows 8/8.1/10 Run-time.

    1. What ever you suggested- setting Font using properties window: Works with Windows Phone 8.1/Windows 8/8.1/10 Run-time, and not with windows phone 8.1 silverlight.

    2. Even we try to add the Windows Phone 8.1/Windows 8/8.1/10 Run-time generated Font name in windows phone 8.1 silverlight, it works on xaml designer only and not in emulator & device.

    Please see below image:


    Even if we building for windows 10, How do we get the properties window generated name for TTF file using C# code. Currently we using below code to get Font Family name from TTF files.

    PrivateFontCollection fontCol = new PrivateFontCollection();
    fontCol.AddFontFile(@"PATH TO FONT");

    What we need now is,

    1. How to get working this in windows phone silverlight?

    2. How to resolve new problem: getting properties window generated name?


    Pallam Madhukar Windows Phone Developer

    Thursday, October 29, 2015 10:37 AM
  • Please can one else help on this?


    Pallam Madhukar Windows Phone Developer

    Tuesday, November 3, 2015 5:48 AM
  • This thread is create at August, it may be closed. Please don't ask new question under a old thread. Create a new thread and describe your issue detailed.
    Wednesday, November 4, 2015 1:46 AM
  • Thanks Arno Liu,

    I have created thread here.


    Pallam Madhukar Windows Phone Developer

    Wednesday, November 4, 2015 5:38 AM