ButtonCirclePlugin icon indicating copy to clipboard operation
ButtonCirclePlugin copied to clipboard

Unhandled Exception while using FontAwesomeWeb (ttf) version 5.3.1

Open npagare opened this issue 6 years ago • 3 comments

Describe the bug Hi @wilsonvargas, thank you for helping us with this great plugin. To make use of font icons from the latest version (53.1) of FontAwesomeWeb (ttf) filesI updated the my App's info.plist file as below. fa-solid-900.ttf fa-regular-400.ttf fa-brands-400.ttf MaterialIcons-Regular.ttf

But while testing my changes with ButtonCirclePlugin using FontAwesomeWeb v5.3.1 I am getting unhandled exception error as shown below.

Can you please confirm if your codebase is tied only to your version of the Font Awesome and Material ttf files? <cFAB:CircleButton IsVisible="True"
Grid.Row="0" Grid.Column="1" x:Name="fabRound"
FontIcon="FontAwesome" <=== this is a as is enum from your code. How does it read the key value from about updates in the info.plist? It doesn't throw any error when using around MaterialIcon even when my value in the info.plist is as shown above Icon="fa-bed"
FontSize="15" TextColor="WhiteSmoke" HeightRequest="35" WidthRequest="35" BorderThickness="5" BorderColor="Red" BackgroundColor="White" Clicked="Clicked"/>

To Reproduce Steps to reproduce the behavior:

  1. Go to '...' Download latest FontAwesomeWeb v5.3.1 font file

  2. Click on '....' unzip the downloaded file. Copy all 3 ttf files from {downloadfolder\fontawesome-free-5.3.1-web\fontawesome-free-5.3.1-web\webfonts} in your iOS app's resources folder. Use https://github.com/smourier/FontAwesomeEnum to create a fontAwesomeWeb Enum class. I have a attached .cs file that has new enums and literals defined for version 5.3.1. Remove the .txt extension to get to .cs file. FontAwesomeWeb531Font.cs.txt

  3. Scroll down to '....' Update your info.plist as shown above 3.1 in App.xaml include following resource declarations

    <Application.Resources>

     <ResourceDictionary>
         <OnPlatform 
     		x:Key="FontAwesomeWeb531SIconsFontFamily" 
             x:TypeArguments="x:String"
     		Android="fa-solid-900.ttf#FontAwesome5FreeSolid"
     		iOS="FontAwesome5FreeSolid" />
    
         <OnPlatform 
     		x:Key="FontAwesomeWeb531RIconsFontFamily" 
             x:TypeArguments="x:String"
     		Android="fa-regular-400.ttf#FontAwesome5FreeRegular"
     		iOS="FontAwesome5FreeRegular" />
    
         <OnPlatform 
     		x:Key="FontAwesomeWeb531BFontFamily" 
             x:TypeArguments="x:String"
     		Android="fa-brands-400.ttf#FontAwesome5BrandsRegular"
     		iOS="FontAwesome5BrandsRegular" />
    
         <OnPlatform 
     		x:Key="MaterialIOIconFontFamily" 
             x:TypeArguments="x:String"
     		Android="MaterialIcons-Regular.ttf#MaterialIcons-Regular"
     		iOS="MaterialIcons-Regular" />
    
           </ResourceDictionary>
     </Application.Resources>
    
  4. See error - see the screenshot below

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. image

Please complete the following information:

  • Which version of the ButtonCircle do you use? 2.0.3
  • Which version of Xamarin.Forms do you use? 3.2 pre2
  • Which OS are you talking about? iOS 11.14

Thanks

npagare avatar Sep 01 '18 01:09 npagare

Also, when it works on Android, it renders the button two times (flickers) where first it displays the button with the default radius size, and the it renders second time to adjust it to my new radius size.

npagare avatar Sep 01 '18 02:09 npagare

Hi @wilsonvargas ,

Looking at the source code of your plugin, I think I penciled down where the issue / the enhancement that will be appreciated to support all (free and paid Pro version of ) 3 official FontAwesomeWeb ttf files declared in the info.plist file.
Adding fontawesomeweb.ttf (which is a very old version) in my iOS resource folder did remove the issue. But I don't want to include multiple versions of the FontAwesomeWeb ttf files. I have copied all 3 ttf files as stated in the description the respective resources folders of my in my Android and iOS App projects.

It was working in my android app version because I do have a old copy of the fontawesome file "fontawesome.ttf" in the asset folder, which I did exclude in the iOS version. Not having that file is throwing the error above. I would kindly request to throw a user defined error to indicate missing file. I also plan to remove that ttf file from Android project to eliminate multiple versions and to keep my App size at the optimum level.

I hope you will consider supporting my request.

image

Thanks

npagare avatar Sep 01 '18 08:09 npagare

Hi @wilsonvargas, just checking to see if you got any input on this issue ?

Thanks

npagare avatar Sep 04 '18 19:09 npagare