Feature Request: Public Font Interface for Consistent Font Handling Across Controls
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
There should be a simple **public interface** for common font-related properties like `FontFamily`, `FontSize`, and `FontAttributes` that controls can implement. This would make it easier for developers to handle font settings consistently across custom controls, behaviors, and theming systems.
Right now, there is an internal interface called [`IFontElement`](https://github.com/dotnet/maui/blob/3f5adff66fb7e0e53a9cd6d749763927374d3164/src/Controls/src/Core/IFontElement.cs) that is used by many built-in controls.
Please consider exposing a similar public interface with the core font-related properties.
### Public API Changes
Propose adding a new public interface, for example:
```csharp
public interface IFontProperties
{
FontAttributes FontAttributes { get; }
string FontFamily { get; }
double FontSize { get; }
bool FontAutoScalingEnabled { get; }
}
```
### Intended Use-Case
Custom controls, theming, and behaviors often need to interact with font settings. A public font interface makes it easy to write reusable code instead of duplicating logic or using workarounds. It's a common scenario for anyone building on top of MAUI.
Contributor guide
Research direction
Start by reading src/Controls/src/Core/IFontElement.cs, which is the existing internal interface referenced by the issue. Compare its role with the proposed public IFontProperties API and review how built-in controls consume font settings. Done means the public interface design is agreed and its use for consistent font handling across controls, behaviors, and theming is validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100