I'm trying to use a custom glyph font. It works the first time that the View appears, but the second time a rectangle with a X inside will be rendered instead.
IconLabel
extending Label
.<OnPlatform x:Key="Font.Glyph" x:TypeArguments="x:String">
<On Platform="Android" Value="Fonts/project_icons.ttf#ProjectIcons"/>
<On Platform="iOS" Value="ProjectIcons"/>
</OnPlatform>
<Style TargetType="{x:Type n:IconLabel}">
<Setter Property="FontFamily" Value="{StaticResource Font.Glyph}"/>
<Setter Property="FontSize" Value="40"/>
<Setter Property="TextColor" Value="{DynamicResource Color.Foreground}"/>
</Style>
1.1.5.188
MyApp2.2.4
MyApp7.1.0
MyApp2.2.4
MyApp2.4.11.982
MyApp2.4.5
MyApp2.2.4
MyApp3.2.0
MyApp1.1.0
MyApp2.4.11.982
MyApp5.0.0-beta
MyApp3.2.0
MyApp2.4.11.982
MyApp5.2.0
MyApp2.0.11
MyApp0.9.1
MyApp2.0.5
MyApp3.2.2
MyApp1.0.5
MyApp2.2.4
MyApp2.0.0
MyApp4.0.1.5
MyApp1.1.0
MyApp2.0.3
MyApp1.0.21
MyApp4.7.9
MyApp4.0.0.482894
MyApp1.0.7
MyApp5.2.0
MyApp.iOS2.0.11
MyApp.iOS1.0.7
MyApp.iOS1.0.5
MyApp.iOS0.9.1
MyApp.iOS5.0.0-beta
MyApp.iOS1.1.5.188
MyApp.iOS1.1.0
MyApp.iOS4.0.1.5
MyApp.iOS2.4.11.982
MyApp.iOS2.4.11.982
MyApp.iOS2.4.11.982
MyApp.iOS4.0.0.482894
MyApp.iOS1.1.0
MyApp.iOS3.2.0
MyApp.iOS5.2.0
MyApp.Android2.0.11
MyApp.Android1.0.7
MyApp.Android1.0.5
MyApp.Android0.9.1
MyApp.Android5.0.0-beta
MyApp.Android1.1.5.188
MyApp.Android1.1.0
MyApp.Android4.0.1.5
MyApp.Android2.4.11.982
MyApp.Android2.4.11.982
MyApp.Android2.4.11.982
MyApp.Android4.0.0.482894
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android28.0.0.1
MyApp.Android1.1.0
MyApp.Android3.2.0
MyApp.Android60.1142.1
MyApp.Android This is the result:
Not yet...
It has something to do with the previous view being displayed. I have to do more tests.
Duplicate of https://github.com/xamarin/Xamarin.Forms/issues/6317
See my comment for workaround
@toomasz Is it? Because mine is a simple Label
, not a FontImageSource
.
Btw, I noticed that it only happens when going back and forth displaying the previous View in which it contains a dragabble list view by the Sharpnado nuget and images from FFImageLoading nuget.
For example, if I go to the next view and go back to the view that displays the label from the picture, it will work normally.
@NickeManarin I strongly suggest you attach a sample which reproduces the issue in order to increase the chance of getting it fixed. I know, I know, it's boring but it's worth it 馃憣.
@andreinitescu Yes, that was my original idea. But since the project is closed source, I need to create a sample project that simulates the issue.
I'm going to do that in the following days.
@NickeManarin Try the fix here https://github.com/xamarin/Xamarin.Forms/issues/6317#issuecomment-498358580 if it fixes the issue then it's a duplicate as mentioned above.
It happened something worse, now the icons inside a FontImageSource
(inside a button) are gone.
But... I'm not experiencing the issue with the faulty icon anymore with the IconLabel
(that extends a Label
).
At first I thought it could be something related to the fact that my button was invisible at first (but later was being displayed), but I tested on a button that is always visible... Same issue.
Duplicate of #6317. @NickeManarin if you think it's different, add a comment. And if you can a repro sample ;)
So, here's the test project: https://github.com/NickeManarin/Xamarin.Demos2
There's two files in which I want you people to see:
TestApp.Droid/Renderers/FontIconLabelRenderer.cs
TestApp.Droid/Helpers/FontImageSourceHandler.cs
Both have commented lines, right above the namespace
declaration.
So, the only way to solve this issue for me was to create a label renderer that sets its Font
manually.
Thanks for the sample!. Yes, I see the problem.
@NickeManarin I built a custom nuget based on https://github.com/xamarin/Xamarin.Forms/issues/6317 / https://github.com/xamarin/Xamarin.Forms/pull/6470 and it does seem to fix your issue. Give it a try and confirm if that is the case?
Xamarin.Forms.9.9.16.zip
@NickeManarin would you be able to have another look with the latest Xamarin.Forms version?
According to issue #6317 this is likely to be fixed now. Would be great if you could verify that this fixes it for you as well and close the issue accordingly, thanks!
The bug is fixed for most controls in the latest Xamarin version, but this is still an issue, when a FontImageSource
is used as Shell.FlyoutIcon
or SearchHandler.QueryIcon
.
Most helpful comment
Duplicate of https://github.com/xamarin/Xamarin.Forms/issues/6317
See my comment for workaround