Architecture¶
Accompanist Lyrics UI uses a unique hybrid architecture to escape Skia's buggy drawText and ensure high performance.
Hybrid Approach¶
- Kotlin/Compose: Handles the high-level UI logic, animation state management, and simple rendering.
- Rust (NativeTextEngine): Handles complex text layout, shaping, and generates SDF atlases.
Components¶
The system is split into two main layers:
-
UI Layer (Kotlin):
KaraokeLyricsView: The main entry point composable.LyricsState: Manages the scrolling and active line state.KaraokeLineText: Renders an individual line using the textures provided by the engine.
-
Engine Layer (Rust):
- Shaping: Uses
rustybuzz(harfbuzz port) for correct text shaping. - SDF Generation: Generates Signed Distance Fields for crisp text scaling.
- Atlas Management: Efficiently packs glyphs into textures.
- Shaping: Uses