Open PeterKaa1 opened 7 months ago
i assume that we apply new font to a Label. First, in mauiprogram
register your font to the app builder by the builder's ConfigureFont
extension method:
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>{
.fonts.AddFont("Resources/Fonts/Aquire-Bold.otf", "Aquire");
});
the app will automatically search the font in the local project directory, you can then consume it like so:<Label Text="Aquire in Bold" FontFamily="Aquire"/>
. This works on me you could try it huhu😅
but after doing so try exporing it as apk.
To clarify, fonts work in an independent APK but not inside C# Shell? Is replacing
fonts.AddFont("Resources/Fonts/Aquire-Bold.otf", "Aquire");
with
fonts.AddEmbeddedResourceFont(System.Reflection.Assembly.GetExecutingAssembly(), "Resources/Fonts/Aquire-Bold.otf", "Aquire");
a workaround here?
Edit: Also try changing "Resources/Fonts/Aquire-Bold.otf" to only "Aquire-Bold.otf"
Resource "Resources/Fonts/LilitaOne-Regular.ttf" not found.
Why?? The path is correct.