UraniumUI icon indicating copy to clipboard operation
UraniumUI copied to clipboard

Font asset not found /data/user/0/.../cache/MaterialSymbolsSharp.ttf

Open kaniosm opened this issue 1 year ago • 9 comments

I keep getting the following warning with Material Symbols:

"Font asset not found /data/user/0/.../cache/MaterialSymbolsSharp.ttf"

kaniosm avatar Aug 21 '24 06:08 kaniosm

Did you initialized in MauiProgram?

NiX3r avatar Aug 26 '24 12:08 NiX3r

I'm referencing to this: https://enisn-projects.io/docs/en/uranium/latest/theming/Icons#material-symbols

NiX3r avatar Aug 26 '24 12:08 NiX3r

Hi ,

Yes, I'm referencing both Material and FontAwasome at startup.

.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("Inter.ttf", "Inter"); fonts.AddMaterialSymbolsFonts(); fonts.AddFontAwesomeIconFonts(); })

kaniosm avatar Aug 26 '24 12:08 kaniosm

Your error seems like on Android. Does this error appear on Windows/Linux/iOS either?

NiX3r avatar Aug 26 '24 12:08 NiX3r

No, only on Adnroid, and it happens for both MaterialSymbols and FontAwesome

kaniosm avatar Aug 26 '24 12:08 kaniosm

Hi, I reproduced this issue in a couple of days ago. It might be related to Embedded Resource logic in libraries. When I face this log, everything was working as expected but there was only logs in the console.

https://github.com/enisn/UraniumUI/blob/101ae50b32a1b3fc248efb24ff91796484b7c221/src/UraniumUI.Icons.MaterialSymbols/UraniumUI.Icons.MaterialSymbols.csproj#L29

Probably, MAUI copies fonts into apk, msix or whatever you use, and use them as extracted version. But still, I try to access them from DLL as embedded resource.

I'll check about what can I do

enisn avatar Aug 26 '24 12:08 enisn

Hi Enis,

Yes, I can confirm that the fonts still load and this is only coming as a warning in the logs. It happens very often though and I'm not sure what's the performance impact.

I think this has to do with the way the resource is loaded and possibly there is a retry looking for a different path.

Thx for considering!

kaniosm avatar Aug 26 '24 14:08 kaniosm

I do have this or a version of this Java.Lang.RuntimeException: Font asset not found data/user/0/com.yvanbrunel.dimmermaui/cache/MaterialIconsRound-Regular.otf The app works in Debug but doesn't work in release, unsure if this is the cause but it's one of the exceptions

YBTopaz8 avatar Oct 11 '24 20:10 YBTopaz8

Probably, MAUI copies fonts into apk, msix or whatever you use, and use them as extracted version. But still, I try to access them from DLL as embedded resource.

Its a general MAUI/Android in Release issue. The workaround mentioned here works. https://learn.microsoft.com/en-us/answers/questions/1684493/custom-fonts-not-working-when-uploading-maui-andro

RhomGit avatar Jan 10 '25 04:01 RhomGit