Skip to main content
Logo Appt Light

Scale text on Xamarin

Apps should scale text to the size specified by users in the system settings. This is especially important for visually impaired users because they might not be able to read the text otherwise.

In Xamarin Forms you make styles for the scalable fonts that you use in your app.

First, accessibility scaling should be enabled for named font sizes. This can be done by pass True to the the SetEnableAccessibilityScalingForNamedFontSizes method of the Application. This can also be done in XAML by using ios:Application.EnableAccessibilityScalingForNamedFontSizes="true".

Secondly, you have to register the font and it's properties with the assembly. Afterwards, the fonts can be used in your app and they will automatically scale depending on the users' font size preference.

For more information, see Understand named font sizesNamed font size scaling and Dynamic Styles.

The code examples below shows how to enable font size scaling and how to use dynamic styles.

using Xamarin.Forms;

[assembly: ExportFont("Lobster-Regular.ttf", Alias="Lobster")]
[assembly: ExportFont("Lobster-Bold.ttf", Alias="LobsterBold")]

namespace Project
    public partial class App : Xamarin.Forms.Application


Let us know!