ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Unity Fonts Error

20 Nov 2017, 19:25

When I import my XAML file, I get the following error:

Assets/XAML/test.xaml(11): Unable to convert 'Fonts/Segoe UI Black' to a valid value for property TextBlock.FontFamily.
UnityEngine.Debug:LogError(Object, Object)
<ImportXaml>c__AnonStorey0:<>m__0() (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:359)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

The font family describes what should be used for a TextBlock in my XAML, but it can never find the font I want. Of course, this font was purely for testing so that I could figure out how to actually import fonts correctly: I clearly have not found that out yet! Haha! I have tried different variations of the font family property like 'Fonts/Segoe UI Black.ttf', 'Fonts/#Segoe UI Black', 'Fonts/#Segoe UI Black.ttf', but they never work. What is the way that fonts should be imported into Unity? I have attached the image to show the file structure of the project
Inside 'Fonts', there is a ttf called 'Segoe UI Black.ttf'. Can anyone identify my problem?
Image
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Unity Fonts Error

21 Nov 2017, 11:00

Hi,

You should use FontFamily="Fonts/#Segoe UI" and FontWeight="Black" to select that font.

We internally use FreeType to process font files and it seems that the library uses "Preferred Family" entry in .ttf 'name' table to fill the family name. In that particular font that value is "Segoe UI".

Take a look at this tutorial if you want to know more about text and fonts: http://www.noesisengine.com/docs/Gui.Co ... orial.html
 
ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Re: Unity Fonts Error

21 Nov 2017, 18:08

Hi,

You should use FontFamily="Fonts/#Segoe UI" and FontWeight="Black" to select that font.

We internally use FreeType to process font files and it seems that the library uses "Preferred Family" entry in .ttf 'name' table to fill the family name. In that particular font that value is "Segoe UI".

Take a look at this tutorial if you want to know more about text and fonts: http://www.noesisengine.com/docs/Gui.Co ... orial.html
That worked! Thank you! :D
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity Fonts Error

21 Nov 2017, 21:13

By the way we plan to show this information (and a nice text rendering preview) in the Unity preview panel.

Thanks for your feedback!

Who is online

Users browsing this forum: No registered users and 23 guests