xamarin/Xamarin.Forms

[Bug] Custom font not displaying correctly when loading the page again

Open

#6,666 opened on Jun 26, 2019

 (14 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
e/3 :clock3:help wantedt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

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.

Steps to Reproduce

  1. I simply created a font online using the IconMoon web app.
  2. I added the font to the Android project normally, adding as AndroidAsset.
  3. I created a simple IconLabel extending Label.
  4. After that I added two resources in the App.xaml file:
<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. I have a ContentPage that displays multiple ContentViews. When changing the content view being displayed (back and forth), after the displaying the glyphs correctly one time, all subsequent displays will have the incorrect glyph.

Basic Information

  • Version with issue:
  • Last known good version: n/a
  • IDE: Visual Studio for Windows. 16.1.4
  • Platform Target Frameworks: Only tested in Android.
    • iOS: n/a
    • Android: 9 (pie)
    • UWP: n/a
  • Android Support Library Version: 28
  • Nuget Packages:
    Rg.Plugins.Popup 1.1.5.188 MyApp
    Microsoft.EntityFrameworkCore 2.2.4 MyApp
    Polly 7.1.0 MyApp
    Microsoft.EntityFrameworkCore.Sq... 2.2.4 MyApp
    Xamarin.FFImageLoading 2.4.11.982 MyApp
    NodaTime 2.4.5 MyApp
    Microsoft.EntityFrameworkCore.De... 2.2.4 MyApp
    Xamarin.Forms.GoogleMaps 3.2.0 MyApp
    Sharpnado.Forms.HorizontalListView 1.1.0 MyApp
    Xamarin.FFImageLoading.Forms 2.4.11.982 MyApp
    Plugin.Permissions 5.0.0-beta MyApp
    Xam.Plugin.Connectivity 3.2.0 MyApp
    Xamarin.FFImageLoading.Transform... 2.4.11.982 MyApp
    CarouselView.FormsPlugin 5.2.0 MyApp
    DLToolkit.Forms.Controls.FlowLis... 2.0.11 MyApp
    Forms.Controls.FlexButton 0.9.1 MyApp
    fusillade 2.0.5 MyApp
    Ideine.ModernHttpClient 3.2.2 MyApp
    DLToolkit.Forms.Controls.TagEntr... 1.0.5 MyApp
    Microsoft.EntityFrameworkCore.Tools 2.2.4 MyApp
    MLToolkit.Forms.SwipeCardView 2.0.0 MyApp
    Xam.Plugin.Media 4.0.1.5 MyApp
    Xamarin.Essentials 1.1.0 MyApp
    NETStandard.Library 2.0.3 MyApp
    Xamarin.Forms.PancakeView 1.0.21 MyApp
    Refit 4.7.9 MyApp
    Xamarin.Forms 4.0.0.482894 MyApp
    DLToolkit.Forms.Controls.ImageCr... 1.0.7 MyApp
    CarouselView.FormsPlugin 5.2.0 MyApp.iOS
    DLToolkit.Forms.Controls.FlowLis... 2.0.11 MyApp.iOS
    DLToolkit.Forms.Controls.ImageCr... 1.0.7 MyApp.iOS
    DLToolkit.Forms.Controls.TagEntr... 1.0.5 MyApp.iOS
    Forms.Controls.FlexButton 0.9.1 MyApp.iOS
    Plugin.Permissions 5.0.0-beta MyApp.iOS
    Rg.Plugins.Popup 1.1.5.188 MyApp.iOS
    Sharpnado.Forms.HorizontalListView 1.1.0 MyApp.iOS
    Xam.Plugin.Media 4.0.1.5 MyApp.iOS
    Xamarin.FFImageLoading 2.4.11.982 MyApp.iOS
    Xamarin.FFImageLoading.Forms 2.4.11.982 MyApp.iOS
    Xamarin.FFImageLoading.Transform... 2.4.11.982 MyApp.iOS
    Xamarin.Forms 4.0.0.482894 MyApp.iOS
    Xamarin.Essentials 1.1.0 MyApp.iOS
    Xamarin.Forms.GoogleMaps 3.2.0 MyApp.iOS
    CarouselView.FormsPlugin 5.2.0 MyApp.Android
    DLToolkit.Forms.Controls.FlowLis... 2.0.11 MyApp.Android
    DLToolkit.Forms.Controls.ImageCr... 1.0.7 MyApp.Android
    DLToolkit.Forms.Controls.TagEntr... 1.0.5 MyApp.Android
    Forms.Controls.FlexButton 0.9.1 MyApp.Android
    Plugin.Permissions 5.0.0-beta MyApp.Android
    Rg.Plugins.Popup 1.1.5.188 MyApp.Android
    Sharpnado.Forms.HorizontalListView 1.1.0 MyApp.Android
    Xam.Plugin.Media 4.0.1.5 MyApp.Android
    Xamarin.FFImageLoading 2.4.11.982 MyApp.Android
    Xamarin.FFImageLoading.Forms 2.4.11.982 MyApp.Android
    Xamarin.FFImageLoading.Transform... 2.4.11.982 MyApp.Android
    Xamarin.Forms 4.0.0.482894 MyApp.Android
    Xamarin.Android.Support.Design 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.v7.AppCo... 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.v4 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.v7.CardView 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.v7.Media... 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.Core.Utils 28.0.0.1 MyApp.Android
    Xamarin.Android.Support.CustomTabs 28.0.0.1 MyApp.Android
    Xamarin.Essentials 1.1.0 MyApp.Android
    Xamarin.Forms.GoogleMaps 3.2.0 MyApp.Android
    Xamarin.GooglePlayServices.Location 60.1142.1 MyApp.Android
  • Affected Devices: Nokia 6.1 Plus, works normally when debugging in emulator.

Screenshots

This is the result: Screenshot_20190626-135623

Reproduction Link

Not yet...

Contributor guide