Symbol and HTML entities will not render in WebGL when placed in viewmodel
NoesisGUI v 3.2.0
Unity v 2022.3.5f1
I have a TextBlock element with the Text property bind to a string property in the ViewModel. When launched in WebGL, there seems to be some rendering issues with the symbols. The text:
Text displayed in WebGL when placed in the ViewModel to bind:
Text displayed in WebGL when placed directly in the Text property of the xaml (no binding):
Text displayed in Unity when placed in the ViewModel to bind:
Text displayed in Unity when placed directly in the Text property of the xaml (no binding):
There seems to be something going on with the binding with the viewmodel and xaml in WebGL. If I wanted to properly display the symbol in the TextBlock's Text through the viewmodel in WebGL, how would I go to approach this?
Unity v 2022.3.5f1
I have a TextBlock element with the Text property bind to a string property in the ViewModel. When launched in WebGL, there seems to be some rendering issues with the symbols. The text:
This is the symbol: Ω ; Entity: Ω Ohm entity: Ω \nΩ \nΩ \nΩ
Text displayed in WebGL when placed in the ViewModel to bind:
Text displayed in WebGL when placed directly in the Text property of the xaml (no binding):
Text displayed in Unity when placed in the ViewModel to bind:
Text displayed in Unity when placed directly in the Text property of the xaml (no binding):
There seems to be something going on with the binding with the viewmodel and xaml in WebGL. If I wanted to properly display the symbol in the TextBlock's Text through the viewmodel in WebGL, how would I go to approach this?
-
sfernandez
Site Admin
- Posts: 3112
- Joined:
Re: Symbol and HTML entities will not render in WebGL when placed in viewmodel
Hello,
HTML/XML entities are only required in the XAML code to avoid conflicts with the XML syntax. The XML parser will convert them into the actual unicode characters to set the property value.
So in your ViewModel (or code behind) you will just use the final UTF8 string that will be directly set in the property.
If you have problems rendering some glyphs it might be that the font you're using does not define them. Try to include a font in your project that defines all those glyphs and set the FontFamily:
HTML/XML entities are only required in the XAML code to avoid conflicts with the XML syntax. The XML parser will convert them into the actual unicode characters to set the property value.
So in your ViewModel (or code behind) you will just use the final UTF8 string that will be directly set in the property.
If you have problems rendering some glyphs it might be that the font you're using does not define them. Try to include a font in your project that defines all those glyphs and set the FontFamily:
Code: Select all
<TextBlock FontFamily="Fonts/#Arial Unicode MS" Text="{Binding SomeText}"/>
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests