- peerlessDJ
- Posts: 34
- Joined:
Font Icon Problem
I have a Font Icon, and it displayed correctly in xaml
When it bind a variable in CPP, it displayed error in xaml [4.png]
[5.png]
And i try to unicode string
[6.png]
[7.png]
When it bind a variable in CPP, it displayed error in xaml [4.png]
[5.png]
And i try to unicode string
[6.png]
[7.png]
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Font Icon Problem
In code you should escape the unicode characters using '\u' + the hexadecimal value of the character.
For example, I could write the following xaml:
And in code expose a Unicode property in the ViewModel initilized as:
That will render the volume-down for both texts.
From the images you attached it seems that it is not finding the glyph in the supplied font, and is using our internal fallback font that renders the ? for not found glyphs.
For example, I could write the following xaml:
Code: Select all
<Grid x:Class="Testing.UnicodeTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="" FontFamily="Fonts/#Font Awesome 5 Free" FontSize="40" FontWeight="Bold"/>
<TextBlock Text="{Binding Unicode}" FontFamily="Fonts/#Font Awesome 5 Free" FontSize="40" FontWeight="Bold"/>
</StackPanel>
</Grid>
Code: Select all
_unicode = "\xEF\x80\xA7"; // UTF-8 representation of \uF027
From the images you attached it seems that it is not finding the glyph in the supplied font, and is using our internal fallback font that renders the ? for not found glyphs.
Re: Font Icon Problem
In C++ you must always use UTF8.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 7 guests