Skip to content

Discussion on the implementation of NamedSize fonts in Core #3938

Closed as not planned

Description

@hartez

Based on the discussions here:

And the work here:

We now in a place that both needs and does not need NamedSize...

The original design offered 2 features: font scaling and a special meaning to the OS

Font Scaling

Status: improved and complete

The NamedSize concept used to be the only way to get scaled font sizes, but now it is built into the Core Font using the AutoScalingEnabled property or WithAutoScaling method. This is exposed at the Controls layer with a bunch of FontAutoScalingEnabled bindable properties on many of the controls that display text.

The default value of FontAutoScalingEnabled is true which means that the font is scaled when a11y values are changed. So if the UI scaling is 2x and the font size is 12, then the actual rendered size is 24.

This can be disabled by setting FontAutoScalingEnabled to `false":

<Label Text="Hello Scaled World!"
       FontSize="12"
       FontAutoScalingEnabled="false" />

Special Meaning

Status: under discussion

The other value that the NamedSize values offered was for special OS meanings. However, this was often deceiving because it was a first-run thing and then fell apart. At XAML parse time, they are translated into a double with no idea that they were special values. Thus, they never did respond to OS changes. Once set, they are just a number and nothing special.

If we want to actually expose those values to the user, we can maybe use a "stringly-typed enum" to allow for supporting the other values on the system. For example, we only had Title1, but there is also a Title2 and Title3.

Activity

  1. added
    area-fonts
    on Feb 10, 2022
  2. added this to the .NET 7 milestone on Apr 26, 2022
  3. changed the title [-]Do we want to keep the concept of NamedSize Fonts at the MAUI Core level? If so, do we want to make any design changes (allowing custom values, etc.)[/-] [+]Discussion on the implementation of `NamedSize` fonts in Core[/+] on Apr 26, 2022
  4. mattleibow commented on Apr 26, 2022

    @mattleibow
    Member

    There was a discussion sort of starting here by @GalaxiaGuy: #831 (comment)

    There are few extra features around this I would like support for (some of these are Forms-y and some Essentials-y but I guess they all go here now?):

    • Text that isn't scaled, regardless of device setting.
    • Scale an arbitrary size in the same way as font size.

    (Of the two, I've used the second more often - think something like sizing the image of a custom radio button).

    • Query the current accessible font scaling details.
    • A notification when it changes.

    For the points:

    1. "Text that isn't scaled"
      This is now implemented via the FontAutoScalingEnabled property.
    2. "Scale an arbitrary size"
      Not quite sure what this means. Are you expecting to set a FontSize of 12 and then also have a FontScaling be a 3 and thus result in a true font size of 36? This might actually be better set using a converter? @StephaneDelcroix do we support some dynamic resource as a converter parameter? That could be used as a way to set a size and then bind to some scaling - or the reverse.
    3. "Query the current accessible font scaling"
      @PureWeen @rachelkang do we have some feature like this already? Somehow feels familiar yet distant...
    4. "A notification when it changes"
      This probably goes after the implementation of the previous point. I wonder if the Microsoft.Maui.Devices.DisplayInfo.MainDisplayInfoChanged event fires if scaling changed... That might be useful with the scaling value, however it is actually related to monitor scaling more. This needs more investigation if we implement the previous point.
  5. rachelkang commented on Apr 26, 2022

    @rachelkang
    Member

    To my knowledge, we don't currently have anything beyond FontAutoScalingEnabled to query for font scaling!

  6. GalaxiaGuy commented on Apr 26, 2022

    @GalaxiaGuy
    Contributor

    Regarding point 2:

    I mean the inverse of point 1. The ability to set something that is sized in the same way the font scales. i.e. using sp on Android for something that isn't a font. The places I've use this are for things that need to be sized relative to font size.

    At the moment in Forms I'm using custom markup extension to do it.

  7. added
    Task
    on Jul 31, 2023
  8. kubaflo commented on Oct 25, 2026

    @kubaflo
    Contributor

    Thank you for the detailed discussion and for separating automatic font scaling from platform-specific semantic text sizes.

    We do not currently plan to pursue the proposed Core NamedSize redesign or introduce the broader API surface discussed here under this proposal, so we are closing this discussion as not planned.

    FontAutoScalingEnabled already provides control over automatic font scaling, but it is not equivalent to semantic text styles, scaling non-text dimensions, or querying and observing the accessibility font scale. This closure does not imply that those separate capabilities are all implemented or that the existing NamedSize API is being removed.

    Thank you for documenting the scenarios and trade-offs.

  9. locked and limited conversation to collaborators on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Taskarea-fonts

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions