dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

FontImage not support woff2 format #23217

Open CodingOctocat opened 5 months ago

CodingOctocat commented 5 months ago

Description

I want to use Google Material Symbols/github

But the font icon shows up as a tofu box character image

Steps to Reproduce

  1. Download Google Material Symbols/github
  2. Copy MaterialSymbolsRounded.woff2(renamed) to /Resources/Fonts
  3. ConfigureFonts fonts.AddFont("MaterialSymbolsRounded.woff2", "MaterialSymbols");
  4. Use it anywhere
<ShellContent>
    <ShellContent.Icon>
        <FontImageSource FontFamily="MaterialSymbols"
                         Glyph="&#xe8b6;"/>
    </ShellContent.Icon>
</ShellContent>

Link to public reproduction project repository

CodingOctocat/MauiIssue_23217

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android API 34

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 5 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

hansmbakker commented 5 months ago

Is it possible that this is related to https://github.com/dotnet/maui/issues/16604?

kubaflo commented 4 months ago

I think that direct support for WOFF fonts in native Android apps is not provided.

hansmbakker commented 4 months ago

Is it possible that this is related to #16604?

What I meant: the original post mentions Material Symbols and links to a specific font file, which are variable fonts. Currently MAUI does not support variable fonts.

In order to use those fonts, currently they have to be converted to static fonts with given settings for e.g. weight and fill (explained in #16604). That issue was actually reported to triggered by the lack of built-in support for using Material Symbols.

@kubaflo Can you please check whether this is a duplicate of the earlier #16604?