maui
maui copied to clipboard
Font not found in Android, but works well in Windows.
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
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.
Could you please create an example repo with the fonts you used and how you set up your project? That'll help debug it.
It's all exactly described in that stackoverflow post, including reproduction.
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.
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.
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.
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.
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.
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:
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.