Page 1 of 1

Unity Fonts Error

Posted: 20 Nov 2017, 19:25
by ajsmith595
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

Re: Unity Fonts Error

Posted: 21 Nov 2017, 11:00
by sfernandez
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

Re: Unity Fonts Error

Posted: 21 Nov 2017, 18:08
by ajsmith595
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

Re: Unity Fonts Error

Posted: 21 Nov 2017, 21:13
by jsantos
By the way we plan to show this information (and a nice text rendering preview) in the Unity preview panel.

Thanks for your feedback!