Skip to content

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:

  1. 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.
  2. 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.