dotnet / dotnet/maui

Re-use Cached Typeface for FontExtensions.ToTypeface()

Open
#28,642 0 comments 0 reactions 0 assignees View on GitHub
area-fonts perf/general platform/android proposal/open t/enhancement ☀️
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

https://github.com/dotnet/maui/blob/9.0.50/src/Graphics/src/Graphics/Platforms/Android/FontExtensions.cs#L15
always try to load font from resource/assets dir,

however, it seems FontManager already created & cached some typeface object?
https://github.com/dotnet/maui/blob/main/src/Core/src/Fonts/FontManager.Android.cs#L56

so why not re-use the cached typeface?

### Public API Changes

No

### Intended Use-Case

avoid load font again & again.

Contributor guide

Open the contributing guide

Research direction

Start by comparing src/Graphics/src/Graphics/Platforms/Android/FontExtensions.cs at line 15 with src/Core/src/Fonts/FontManager.Android.cs at line 56. Trace how FontManager creates and caches typefaces, then determine whether ToTypeface() can reuse that cache; done means avoiding repeated font loads without changing the public API.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.