xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] ExportFont not working on UWP #10307

Closed JasonLooney closed 4 years ago

JasonLooney commented 4 years ago

Description

Custom fonts are not showing up in UWP when the new ExportFontAttribute is used.

Steps to Reproduce

  1. Add a TTF or OTF file from Google Fonts, FontAwesome, icomoon, etc. as an embedded resource in your shared project
  2. Add the ExportFont attribute to your assembly. e.g. [assembly: ExportFont("FA5Regular.otf", Alias = "FontAwesome")]
  3. Reference the font family in XAML markup
  4. Compile and run the UWP app

Expected Behavior

Custom font should be used.

Actual Behavior

Custom font is used in iOS and Android, but not UWP.

Basic Information

Reproduction Link

https://github.com/jfversluis/EmbeddedFontsSample

BillyMartin1964 commented 4 years ago

@ArtjomP , are you installing to another machine?

ArtjomP commented 4 years ago

@BillyMartin1964 sure I'm developing apps on my machine, CI with UI testing on another one and users use my apps from the Store on their PC & Xboxes

BillyMartin1964 commented 4 years ago

@ArtjomP , can't tell you about the store because I'm afraid to use it on a production app. I can tell you, the only difference between the page being blank white or not is removing the FontFamily attribute. The square seems to be an icon on his.

ArtjomP commented 4 years ago

@BillyMartin1964 you could try to remove obj & bin folders & rebuild your project with FontFamily attribute included. It helps to get rid of mysterious errors sometimes.

MichielDG commented 4 years ago

Why was this closed? Although custom fonts work in UWP debug, they don't work in a release version.

When i use them in a release version sideload, the page that the custom font is on is completely blank. When I comment out the font family in xaml, the page appears fine... but without custom fonts, of course.

I also checked in the windows/font folder and the font was on the laptop I installed the app on.

There is a new issue for this: #12404