Skip to content

⚡ Async font loading and virtualized font dropdown to eliminate UI stutter#4004

Merged
guiyanakuang merged 2 commits intomainfrom
refactor/issue-4003-async-font-loading
Mar 8, 2026
Merged

⚡ Async font loading and virtualized font dropdown to eliminate UI stutter#4004
guiyanakuang merged 2 commits intomainfrom
refactor/issue-4003-async-font-loading

Conversation

@guiyanakuang
Copy link
Copy Markdown
Member

Closes #4003

Summary

  • FontManager: Replace eager availableFonts/selectableFonts with MutableStateFlow, load fonts asynchronously on Dispatchers.IO in init block. currentFontInfo uses combine() to react when fonts finish loading.
  • FontSettingItemView: Replace DropdownMenu (composes all 100+ items at once) with Popup + LazyColumn (virtualized, only visible items composed). Shows loading spinner while fonts load. Auto-scrolls to selected font.
  • LanguageSettingItemView: Move DropdownMenu into trailingContent with wrapContentSize(Alignment.TopEnd) for correct anchor positioning on constrained-width layouts (iPad).

Three blocking points eliminated

  1. getSystemFonts() + GraphicsEnvironment.availableFontFamilyNames — moved to IO thread
  2. FontFamily object creation for each system font — moved to IO thread
  3. Rendering 100+ font items simultaneously — replaced with virtualized LazyColumn

Test plan

  • Verify font dropdown opens without stutter
  • Verify loading spinner appears briefly if fonts haven't loaded yet
  • Verify font list auto-scrolls to currently selected font
  • Verify selecting a font applies it correctly
  • Verify language dropdown positions correctly on constrained-width layouts
  • Verify app startup is not blocked by font enumeration

@guiyanakuang guiyanakuang merged commit 0f76507 into main Mar 8, 2026
2 checks passed
@guiyanakuang guiyanakuang deleted the refactor/issue-4003-async-font-loading branch March 8, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async font loading and virtualized font dropdown to eliminate UI stutter

1 participant