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

Custom Fonts Don't Show On A Real Device #19935

Open ShariatPanah opened 10 months ago

ShariatPanah commented 10 months ago

Description

Hey, i have added some Fonts to my Resources, and then added in ConfigureFonts, when i run the app on an android emulator (Android 12.0) the fonts show up as expected with no problems. but when i run the app on my real android device (Android 8.0), the fonts won't show up, like they dont exist at all. so where is the problem? is it a Maui Bug or something that i'm missing?

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 8.0 and 12.0

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 10 months ago

Hi @ShariatPanah. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

drasticactions commented 10 months ago

Could you please create an example project showing how you're adding the fonts?

ShariatPanah commented 10 months ago

i add the fonts to this directory: Resources\Fonts and I make sure the BuildAction of the fonts is set to MauiFont, then i register these fonts in ConfigureFonts method. this is the process i do. and here is a repro project: https://github.com/ShariatPanah/FontsBug/

Zhanglirong-Winnie commented 8 months ago

Verified this issue with Visual Studio 17.10.0 preview2 (8.0.14). Not repro on android device with sample project. I can't repro this issue on Xiaomi, Google, and Samsung devices.

ShariatPanah commented 8 months ago

@Zhanglirong-Winnie did you test on real devices? could you please tell me what android version are they?

Zhanglirong-Winnie commented 8 months ago

@Zhanglirong-Winnie did you test on real devices? could you please tell me what android version are they?

Yes, I am testing on real devices, I am using XiaoMi (Android 12.5), Samsung (Android 13), Google (Android12).

ShariatPanah commented 8 months ago

@Zhanglirong-Winnie I'm testing on a real device Huawei mate 10 lite (Android 8.0 Api 26) and for this Font I provided in the sample (Raleway.ttf) it won’t apply to the text at all, but on an emulator (Pixel 5 Android 12.0 Api 31) it works just fine.

but I opened another issue here and I described a really strange behavior I’m working with IRANSansMobile(FaNum).ttf on that repro and I can provide the font if you want. I just post the screenshot: 306600048-6ae6895b-a2f9-4d86-b903-d1111a6949e6

so for summary: the font IRANSansMobile(FaNum).ttf which is a Farsi font will apply to just letters (Not to Numbers, meaning the numbers remain on English Font) on my Real Device (Huawei Android 8.0) but on the Emulator it applies to all numbers and letters as expected. on the other hand for Raleway.ttf it won’t apply to any text on Huawei, but works just fine on the Emulator.

I updated the maui to version 8.0.14 and I don’t see any fix here, at least not for my Device (Huawei) So I don’t know maybe I’m missing something here?

mattleibow commented 5 days ago

Do you have another device to try?

dotnet-policy-service[bot] commented 5 days ago

Hi @ShariatPanah. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

dotnet-policy-service[bot] commented 1 day ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.