phanq
Topic Author
Posts: 1
Joined: 11 Sep 2023, 19:41

Symbol and HTML entities will not render in WebGL when placed in viewmodel

30 May 2024, 15:15

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:
This is the symbol: Ω ; Entity: Ω Ohm entity: Ω \nΩ \nΩ \nΩ

Text displayed in WebGL when placed in the ViewModel to bind:
  • ViewModel_WebGL.PNG

Text displayed in WebGL when placed directly in the Text property of the xaml (no binding):
  • XAML_WebGL.PNG

Text displayed in Unity when placed in the ViewModel to bind:
  • ViewModel_Unity.PNG

Text displayed in Unity when placed directly in the Text property of the xaml (no binding):
  • XAML_Unity.PNG
    XAML_Unity.PNG (10.67 KiB) Viewed 1425 times

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?
 
User avatar
sfernandez
Site Admin
Posts: 3112
Joined: 22 Dec 2011, 19:20

Re: Symbol and HTML entities will not render in WebGL when placed in viewmodel

31 May 2024, 11:37

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:
<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