Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug-WPF] FontFamily not working for FontAwesome #11789

Closed
tessarolli opened this issue Aug 14, 2020 · 8 comments · Fixed by #11977
Closed

[Bug-WPF] FontFamily not working for FontAwesome #11789

tessarolli opened this issue Aug 14, 2020 · 8 comments · Fixed by #11977
Labels
a/embedded fonts a/fonts in-progress This issue has an associated pull request that may resolve it! p/WPF s/unverified New report that has yet to be verified t/bug 🐛
Milestone

Comments

@tessarolli
Copy link
Contributor

tessarolli commented Aug 14, 2020

Description

After updating to 4.8, Labels no longer show FontAwesome Icons on WPF Application.
All other Platforms are working as they should.

Steps to Reproduce

<OnPlatform x:Key="FontAwesomeSolid" x:TypeArguments="x:String">
                <On Platform="Android">FontAwesome5_Solid.otf#Regular</On>
                <On Platform="iOS">FontAwesome5Free-Solid</On>
                <On Platform="UWP">/Assets/Fonts/FontAwesome5_Solid.otf#Font Awesome 5 Free</On>
                <On Platform="WPF">pack://application:,,,/Fonts/#Font Awesome 5 Free Solid</On>
            </OnPlatform>

 public static class FASolid
    {
public static string Eraser { get => "\uf12d"; }
}
xmlns:res="clr-namespace:myNameSpace.Resources"
<Label Text="{Static res:FASolid.Eraser}" 
                               FontFamily="{StaticResource FontAwesomeSolid}"
                        </Label>

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue: 4.8+
  • Last known good version: 4.5

Screenshots

Working (UWP):
image

Not Working (WPF):
image

Workaround

Didn't find any, yet..

@tessarolli tessarolli added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 14, 2020
@samhouts samhouts added this to New in Triage Aug 14, 2020
@rmarinho
Copy link
Member

Hi, can you please send us a small reproduction project?

Thanks

@rmarinho rmarinho moved this from New to Needs Info in Triage Aug 14, 2020
@rmarinho rmarinho added the s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. label Aug 14, 2020
@tessarolli
Copy link
Contributor Author

BugReport.zip

@samhouts samhouts removed the s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. label Aug 20, 2020
@samhouts samhouts moved this from Needs Info to New in Triage Aug 20, 2020
@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Aug 24, 2020
@lindexi
Copy link
Contributor

lindexi commented Aug 31, 2020

Why it can not show the right character?

Because the font is pack://application:,,,/Fonts/#Font Awesome 5 Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.ttf#Font Awesome5Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.otf#Font Awesome5Free Solid

@lindexi
Copy link
Contributor

lindexi commented Aug 31, 2020

Why it will set this font name?

See

public static FontFamily ToFontFamily(this string fontFamily, string defaultFontResource = "FontFamilySemiBold")
{
if(string.IsNullOrWhiteSpace(fontFamily))
return (FontFamily)System.Windows.Application.Current.Resources[defaultFontResource];
if (FontFamilies.TryGetValue(fontFamily, out var f))
{
return f;
}
var embeddedResult = fontFamily.TryGetFromAssets();
if (embeddedResult.success)
return FontFamilies[fontFamily] = embeddedResult.fontFamily;
//self.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), fontFamily);
//Cache this puppy!
var formatted = string.Join(", ", GetAllFontPossibilities(fontFamily));
var font = new FontFamily(formatted);
FontFamilies[fontFamily] = font;
return font;
}

It will join the all the font: var formatted = string.Join(", ", GetAllFontPossibilities(fontFamily));

@tessarolli
Copy link
Contributor Author

Why it can not show the right character?

Because the font is pack://application:,,,/Fonts/#Font Awesome 5 Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.ttf#Font Awesome5Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.otf#Font Awesome5Free Solid

I've tried your solution, it did not help.

<On Platform="WPF">pack://application:,,,/Fonts/#Font Awesome 5 Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.ttf#Font Awesome5Free Solid, Assets/Fonts/pack://application:,,,/Fonts/.otf#Font Awesome5Free Solid</On>
I've also tried without the Assets/ on the path.

image

lindexi added a commit to dotnet-campus/Xamarin.Forms that referenced this issue Sep 1, 2020
@lindexi lindexi mentioned this issue Sep 1, 2020
2 tasks
@lindexi
Copy link
Contributor

lindexi commented Sep 1, 2020

@tessarolli I try to fix this in #11977

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Sep 1, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Sep 1, 2020
@PureWeen PureWeen added this to To do in v5.0.1 via automation Nov 5, 2020
@PureWeen PureWeen removed this from In Progress in vNext+1 (5.0.0) Nov 5, 2020
@PureWeen PureWeen added this to the 5.0.1 milestone Nov 5, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Nov 5, 2020
@PureWeen PureWeen removed this from In Progress in vNext+1 (5.0.0) Nov 5, 2020
@DennisWelu
Copy link

@samhouts @PureWeen Looks like this is in and out of the priority list for upcoming releases. What's the thought on a future fix? Looks like @lindexi has a PR in and just pending review. If the fix doesn't make it into a 4.8.x SR, as it appears, it will force me to update everything in the solution to 5.x when that is GA (due to other changes like MasterDetailPage name change etc.). Kinda leaves 4.x WPF solutions hanging.

Triage automation moved this from Needs Estimate to Closed Dec 18, 2020
v5.0.1 automation moved this from To do to Done Dec 18, 2020
rmarinho pushed a commit that referenced this issue Dec 18, 2020
@DennisWelu
Copy link

Can someone explain the relationship the 5.0.1 project has to the 5.0.0 SR process? This fix has been Done for quite some time in the 5.0.1 project and hasn't made it to a SR that I'm aware. When is 5.0.1 targeted for?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/embedded fonts a/fonts in-progress This issue has an associated pull request that may resolve it! p/WPF s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

6 participants