Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font not found in Android, but works well in Windows. #19596

Closed
Dumuzy opened this issue Dec 27, 2023 · 9 comments
Closed

Font not found in Android, but works well in Windows. #19596

Dumuzy opened this issue Dec 27, 2023 · 9 comments
Labels
area-fonts Custom fonts and Font related API's platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@Dumuzy
Copy link

Dumuzy commented Dec 27, 2023

Description

It's exactly described there: https://stackoverflow.com/questions/77704533/font-not-found-in-maui-on-android-works-on-windows

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

No response

Did you find any workaround?

No response

Relevant log output

No response

@Dumuzy Dumuzy added the t/bug Something isn't working label Dec 27, 2023
@drasticactions drasticactions added the s/needs-repro Attach a solution or code which reproduces the issue label Dec 27, 2023
@ghost
Copy link

ghost commented Dec 27, 2023

Hi @Dumuzy. 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
Copy link
Contributor

Could you please create an example repo with the fonts you used and how you set up your project? That'll help debug it.

@Dumuzy
Copy link
Author

Dumuzy commented Dec 28, 2023

It's all exactly described in that stackoverflow post, including reproduction.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Dec 28, 2023
@Eilon Eilon added the area-fonts Custom fonts and Font related API's label Dec 29, 2023
@Redth
Copy link
Member

Redth commented Jan 2, 2024

It looks like from the SO post that one of the fonts works fine on android but the other does not, and they both work fine on windows. It sounds like there may be something to do with the font file itself not being properly formatted in a way that android is able to load and understand it.

While I understand this is frustrating, we don't implement font file parsing in a platform agnostic way, that is to say, we use the underlying platform API's for loading and using fonts. If android is unable to read this specific font file, there's not much we can do about it.

@Redth Redth added s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Jan 2, 2024
@ghost
Copy link

ghost commented Jan 2, 2024

Hi @Dumuzy. 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.

@ghost
Copy link

ghost commented Jan 2, 2024

Hi @Dumuzy. 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.

@Dumuzy
Copy link
Author

Dumuzy commented Jan 3, 2024

That is a joke, you again saying s/needs-info and s/needs-repro. Reproduction is exactly described in that SO post. What other info do you need?
And ok, I understand that MAUI does not want to parse font files. But then, somehow the developer should be informed that font file loading went wrong. There might be some return code or some exception on font file loading not working.
Or at least SOME possibility to check in code if a font is there or not. As it is now, the font I want is not there and another one is used. How should I find this out in code?
Obviously, I as a small app developer can never check all the dozens of android or ios versions if some of the font I use are working on that system. What I could do, is not use a font that fails to load. If I could get to that information in code.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author s/needs-repro Attach a solution or code which reproduces the issue labels Jan 3, 2024
@john-hollander
Copy link
Contributor

I can confirm the behavior above, and here is a repro project:
https://github.com/john-hollander/Maui-Tests/tree/master/ChessFontsTest

That said, I expect that what @Redth suggests about Android not being able to read the font properly is the probable issue, though I haven't tested further.

@Redth
Copy link
Member

Redth commented Jan 15, 2024

Thanks for the repro @john-hollander !

@Dumuzy I understand the stack overflow had the general info listed, however we do ask that issue reporters take specific steps to attach reproduction code so we can focus more time on the actual issue instead of trying to create a repro ourselves, and those issues that have followed those steps will generally have priority over those which do not.

For this issue, it's purely android choosing how to handle the font. I did try setting up a java project with the fonts in Android Studio, and as expected, the behaviour is the same here:

Screenshot 2024-01-15 at 3 51 33 PM

Android doesn't throw an error that I can see either. There may be some API we could use to try and detect if the font will load correctly, that would be a nice idea, but that's not currently on our roadmap.

@Redth Redth closed this as completed Jan 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-fonts Custom fonts and Font related API's platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants