Skip to content

Startup: every font variant in the manifest is preloaded before first frame #24079

Open

Description

@MartinZikmund

What would you like to be added? 💡

Application.PreloadFonts awaits every entry in the default font's manifest before the first frame, with no filtering by weight, width or style.

FontFamilyHelper.PreloadAllFontsInManifest (src/Uno.UI/UI/Xaml/FontFamilyHelper.cs) does:

var tasks = manifest.Fonts
    .Select(fontInfo => PreloadAsync(fontInfo.FamilyName, new FontWeight(fontInfo.FontWeight), fontInfo.FontStretch, fontInfo.FontStyle));

return await Task.WhenAll(tasks)...

A full family declares dozens of variants. Uno.Fonts.OpenSans ships 32 TTF faces (Condensed, SemiCondensed, every weight, every italic). On WebAssembly each face is an individual HTTP request on the startup path.

Proposal: preload only the variants likely to be used before the first frame, and let the rest load on first use, with a FeatureConfiguration knob to control the selection.

Why is this needed? 🤔

Measured on a blank Uno Skia WASM app (Uno.Sdk 6.6.42, net10.0-browserwasm, UnoFeatures=SkiaRenderer), published -c Release and served with brotli over a cold browser context:

  • 37 font requests, 2.62 MB brotli are issued at startup.
  • Splash removal is chained behind the font preload task, so those requests gate perceived startup: first GL draw lands at ~870 ms, the last font at 1 026–1 215 ms, and the splash clears at 1 141–1 306 ms.
  • An equivalent Avalonia Browser app issues zero font requests — its default font ships as a managed resource inside Avalonia.Fonts.Inter.wasm and arrives in the normal parallel assembly batch.

On a shaped 20 Mbps link the same app reaches first frame at 4 524 ms versus Avalonia's 2 499 ms; total transfer is 11.87 MB versus 4.79 MB, of which the fonts are the second-largest single contributor.

Full measured teardown and method: specs/056-wasm-skia-startup-performance/spec.md (branch dev/mazi/wasm-startup-perf).

Renderer 🎨

Skia

For which platforms 📱💻🖥️

WebAssembly primarily; the change is renderer-agnostic and also reduces startup work on other Skia targets.

Anything else we need to know? 💬

This covers only the preload half of the problem — the 32 faces are still deployed. Trimming what Uno.Fonts.OpenSans ships by default is separate follow-up work.

Activity

  1. added
    7.1
    on Oct 14, 2026
  2. removed
    7.1
    on Oct 29, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions