Skip to content

Is there a pattern for using custom fonts from a class library? #10762

Answered by jonx
DanTravison asked this question in Q&A
Discussion options

You must be logged in to vote

This did the trick for me! Thank you so much @matmork. I was missing the ExportFont tags.

For the record, the whole procedure that works for me to add fonts in a MAUI library is the following:

  1. In the library
  • Add your fonts into the Resources\Fonts folder of the project, where its build action will automatically be set to MauiFont. Set the action manually if you add them elsewhere.
  • Add a AssemblyInfo.cs file that has the font attributes as follow:
    [assembly: ExportFont("FontAwesome5Brands.otf", Alias = "FontAwesomeBrands")]
    [assembly: ExportFont("FontAwesome5Solid.otf", Alias = "FontAwesomeSolid")]
    [assembly: ExportFont("FontAwesome5Regular.otf", Alias = "FontAwesomeRegular")]
    You don't…

Replies: 5 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@sunilsolanki-alight
Comment options

Comment options

You must be logged in to vote
1 reply
@tbaggett
Comment options

Comment options

You must be logged in to vote
2 replies
@jonx
Comment options

Answer selected by DanTravison
@DanTravison
Comment options

Comment options

You must be logged in to vote
1 reply
@tbaggett
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants