Error using FontAwesome on Android

I was about to report this a bug but I got it to work but I do feel the inconsistent behavior should be looked into.

I have been using Font Awesome in my application for a while now without problem.  I have a style defined that I use throughout the application for icons.

            <OnPlatform x:TypeArguments="x:String"
                        x:Key="FontAwesomeSolid">
                <On Platform="iOS"
                    Value="Font Awesome 5 Free" />
                <On Platform="Android"
                    Value="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free" />
                <On Platform="UWP"
                    Value="Assets/Fonts/fa-solid-900.ttf#Font Awesome 5 Free Solid" />
            </OnPlatform>

I just added the SfTabView to my application and used FA icons for the tabs using this same style.  On iOS no issue it works perfectly.  However on Android, I get an exception.  

Java.Lang.RuntimeException: Font asset not found Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free

After reviewing the documentation on using fonts with SfTabView, I created a new style with one small change.  I removed the "#Font Awesome 5 Free" from the Android value and it works.

            <OnPlatform x:TypeArguments="x:String"
                        x:Key="FontAwesomeSolidSF">
                <On Platform="iOS"
                    Value="Font Awesome 5 Free" />
                <On Platform="Android"
                    Value="Font Awesome 5 Free-Solid-900.otf" />
                <On Platform="UWP"
                    Value="Assets/Fonts/fa-solid-900.ttf#Font Awesome 5 Free Solid" />
            </OnPlatform>

Seems like the other style should work since it works throughout the app on Android but maybe this post can help someone else.

7 Replies

PA Paul Anderson S Syncfusion Team October 12, 2018 04:28 AM UTC

Hi Brad Young, 
  
Greetings from Syncfusion. 
  
We have already considered to provide support for defining the custom font as like in other Xamarin controls and logged a feature report for the same. This support will be provided to our SfTabView in any of our upcoming Volume release. 
  
Please visit our website periodically for feature updates and releases. 
  
Regards, 
Paul Anderson 



IO IoTFier November 19, 2018 04:12 PM UTC

Hi Paul, do you have any update on this feature ?

I am also stuck on using a workaround provided by Brad Young below.

Thanks


PA Paul Anderson S Syncfusion Team November 22, 2018 11:55 AM UTC

Hi NIlesh, 
 
Thanks for your update. 
 
Query: "do you have any update on this feature ?" 
 
This feature will be implemented and included in our upcoming Volume 4 service pack 1 release, which is expected to be rolled out by January 2019. 
 
Query: "I am also stuck on using a workaround provided by Brad Young below." 
 
Please use the font.ttf file code on the XAML code as mentioned below. We should not provide in the format Filename.ttf#FontName and should only provide filename.ttf as below 
 
<ContentPage.Resources> 
        <ResourceDictionary> 
            <OnPlatform x:TypeArguments="x:String" x:Key="customfontfamily" iOS="Segoe MDL2 Assets" Android="Segoe MDL2 Assets.ttf" WinPhone="Segoe_MDL2_Assets.ttf#Segoe MDL2 Assets"  /> 
       </ResourceDictionary> 
    </ContentPage.Resources> 
 
 
If the issue still occurs at your end, please update us more detail about this. 
 
1.            Sample to reproduce. 
2.            Replication steps. 
 
This will be helpful for us to provide better solution on this. 
 
Please let us know if you have any concern about this. 
 
Regards, 
Paul Anderson 
                                                     



RA RODRIGO AMARAL February 10, 2019 11:53 PM UTC

Is that already implemented ? Because on version 48 I'm still getting this error.


DR Dhanasekar R Syncfusion Team February 11, 2019 11:08 AM UTC

Hi Rodrigo,  
   
Due to stability concerns, we are unable to include the implementation in our Volume 4 SP1. We have planned to include this change in our upcoming weekly NuGet which will be rolled out on 12th February 2019.  
   
Regards,  
Dhanasekar  



PP Petr Pikaus March 18, 2019 06:24 PM UTC

Any progress? I'm using the v16.4.0.54 and still crashing.


VA Vanaja  Annasamy Syncfusion Team March 19, 2019 05:36 PM UTC

Hi Petr Pikaus

Sorry for the inconvenience. We will include the implementation in our Volume 1 which will be rolled out at the end of March.

Regards.
Vanaja R.A.

Loader.
Up arrow icon