0

In Android device or emulator, there will be a set of fonts available as system fonts. The list of fonts can be obtained by using this API AvailableFonts

Questions:

  1. How to display a TextView with the fonts available in the System fonts?
  2. How to use a custom font (like Arial black)?
  3. How to make a custom font available as system font? (that is, how to use the custom font to display a TextView without the need to add the font in the application resource)

1 Answer 1

0

To set default font for the entire app, you can simply do that by making it the first font you add when calling .ConfigureFonts in your MauiProgram, e.g.:

var builder = MauiApp.CreateBuilder();

builder
    .UseMauiApp<App>()
        .ConfigureFonts(fonts =>
        {
            fonts.AddFont("Lato-Regular.ttf", "LatoRegular");
            fonts.AddFont("Lato-Bold.ttf", "LatoBold");
        });

LatoRegular is now the default font.

Please remember to remove the FontFamily property in Styles.xaml for all controls that must use the default font.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.