Package-level declarations

Types

Link copied to clipboard
data class KaraokeBreathingDotsDefaults(val number: Int = 3, val size: ERROR CLASS: Symbol not found for Dp = 16.dp, val margin: ERROR CLASS: Symbol not found for Dp = 12.dp, val enterDurationMs: Int = 3000, val preExitStillDuration: Int = 200, val preExitDipAndRiseDuration: Int = 3000, val exitDurationMs: Int = 200, val breathingDotsColor: ERROR CLASS: Symbol not found for Color = Color.White)
Link copied to clipboard
data class NativeLayoutResult(val glyph_count: Int, val glyph_ids: List<Int>, val positions: List<Float>, val atlas_rects: List<Float>, val glyph_offsets: List<Float>, val total_width: Float, val total_height: Float, val ascent: Float, val descent: Float)

Represents the raw layout result from the native text engine (Rust). Contains positioning and sizing information for a block of text.

Link copied to clipboard
data class SyllableLayout(val syllable: ERROR CLASS: Symbol not found for KaraokeSyllable, val layoutResult: NativeLayoutResult, val wordId: Int, val useAwesomeAnimation: Boolean, val width: Float = layoutResult.total_width, val position: ERROR CLASS: Symbol not found for Offset = Offset.Zero, val wordPivot: ERROR CLASS: Symbol not found for Offset = Offset.Zero, val wordAnimInfo: WordAnimationInfo? = null, val charOffsetInWord: Int = 0, val charLayouts: List<NativeLayoutResult>? = null, val charOriginalBounds: List<ERROR CLASS: Symbol not found for Rect>? = null, val firstBaseline: Float = layoutResult.firstBaseline, val floatEndingTime: Long = 0)

Represents the layout information for a single karaoke syllable. This includes the text layout from the native engine, as well as animation metadata.

Link copied to clipboard
data class WordAnimationInfo(val wordStartTime: Long, val wordEndTime: Long, val wordContent: String, val wordDuration: Long = wordEndTime - wordStartTime)
Link copied to clipboard
data class WrappedLine(val syllables: List<SyllableLayout>, val totalWidth: Float)

Functions

Link copied to clipboard
fun calculateBalancedLines(syllableLayouts: List<SyllableLayout>, availableWidthPx: Float, nativeEngine: NativeTextEngine, style: ERROR CLASS: Symbol not found for TextStyle, density: ERROR CLASS: Symbol not found for Density): List<WrappedLine>

Calculates line wrapping for syllables using a balanced (minimum raggedness) algorithm (Knuth-Plass inspired dynamic programming approach).

Link copied to clipboard
fun calculateGreedyWrappedLines(syllableLayouts: List<SyllableLayout>, availableWidthPx: Float, nativeEngine: NativeTextEngine, style: ERROR CLASS: Symbol not found for TextStyle, density: ERROR CLASS: Symbol not found for Density): List<WrappedLine>
Link copied to clipboard
fun calculateStaticLineLayout(wrappedLines: List<WrappedLine>, isLineRightAligned: Boolean, canvasWidth: Float, lineHeight: Float, isRtl: Boolean): List<List<SyllableLayout>>

Calculates the final static layout positions for all syllables in the wrapped lines. Handles alignment (Left/Right/RTL), row positioning, and relative offsets within the line.

Link copied to clipboard
fun ERROR CLASS: Symbol not found for DrawScope.drawLyricsLine(lineLayouts: List<List<SyllableLayout>>, currentTimeMs: Int, color: ERROR CLASS: Symbol not found for Color, blendMode: ERROR CLASS: Symbol not found for BlendMode, isRtl: Boolean, showDebugRectangles: Boolean = false, atlasManager: SdfAtlasManager? = null)

Draws a multi-row lyrics line into the canvas. Handles row wrapping, padding, and applying the karaoke progress gradient.

Link copied to clipboard
actual fun getFontBytes(fontFamily: FontFamily?, platformContext: Any?): ByteArray?

Get font bytes from FontFamily on Android. Supports:

expect fun getFontBytes(fontFamily: ERROR CLASS: Symbol not found for FontFamily??, platformContext: Any?): ByteArray?

Get font bytes from a FontFamily using platform-specific mechanisms.

actual fun getFontBytes(fontFamily: FontFamily?, platformContext: Any?): ByteArray?

Get font bytes from FontFamily on JVM/Desktop. Supports:

Link copied to clipboard
@Composable
actual fun getPlatformContext(): Any?
expect fun getPlatformContext(): Any?

Get platform-specific context for font loading. Returns Context on Android, null on other platforms.

@Composable
actual fun getPlatformContext(): Any?
Link copied to clipboard
actual fun getSystemFallbackFontBytes(platformContext: Any?): List<ByteArray>

Get system fallback font files for missing glyphs. Returns fonts in priority order. Cached globally to avoid repeated IO and parsing.

expect fun getSystemFallbackFontBytes(platformContext: Any?): List<ByteArray>

Get system fallback font bytes for text that cannot be rendered with the primary font. Returns a system font that supports a wide range of characters (e.g., CJK).

actual fun getSystemFallbackFontBytes(platformContext: Any?): List<ByteArray>

Get system fallback fonts for missing glyphs on JVM/Desktop. Returns fonts in priority order, prioritizing CJK and wide Unicode coverage.

Link copied to clipboard

Get system fallback font files by parsing Android font configuration XML. This parses font_fallback.xml (modern) or fonts.xml (legacy) for reliable discovery. Much more reliable than SystemFonts API, especially for OEM systems (MIUI, etc).

Link copied to clipboard
fun groupIntoWords(syllables: List<ERROR CLASS: Symbol not found for KaraokeSyllable>): List<List<ERROR CLASS: Symbol not found for KaraokeSyllable>>
Link copied to clipboard
fun KaraokeBreathingDots(alignment: ERROR CLASS: Symbol not found for KaraokeAlignment, startTimeMs: Int, endTimeMs: Int, currentTimeProvider: () -> Int, modifier: ERROR CLASS: Symbol not found for Modifier = Modifier, defaults: KaraokeBreathingDotsDefaults = KaraokeBreathingDotsDefaults())

Displays breathing dots animation during instrumental intros or interludes. The dots breathe/pulse and fade in/out to indicate progress during non-lyrical sections.

Link copied to clipboard
fun KaraokeLineText(line: ERROR CLASS: Symbol not found for KaraokeLine, currentTimeProvider: () -> Int, modifier: ERROR CLASS: Symbol not found for Modifier = Modifier, normalLineTextStyle: ERROR CLASS: Symbol not found for TextStyle = LocalTextStyle.current, accompanimentLineTextStyle: ERROR CLASS: Symbol not found for TextStyle = LocalTextStyle.current, activeColor: ERROR CLASS: Symbol not found for Color = Color.White, blendMode: ERROR CLASS: Symbol not found for BlendMode = BlendMode.SrcOver, showDebugRectangles: Boolean = false, precalculatedLayouts: List<SyllableLayout>? = null, isDuoView: Boolean = false, textMeasurer: ERROR CLASS: Symbol not found for TextMeasurer = rememberTextMeasurer(), fontResource: ERROR CLASS: Symbol not found for FontResource?? = null, sharedNativeEngine: NativeTextEngine? = null, sharedAtlasManager: SdfAtlasManager? = null)

Renders a single karaoke line, capable of handling multi-row wrapping.

Link copied to clipboard
fun KaraokeLyricsView(listState: ERROR CLASS: Symbol not found for LazyListState, lyrics: ERROR CLASS: Symbol not found for SyncedLyrics, currentPosition: () -> Int, onLineClicked: (ERROR CLASS: Symbol not found for ISyncedLine) -> Unit, onLinePressed: (ERROR CLASS: Symbol not found for ISyncedLine) -> Unit, modifier: ERROR CLASS: Symbol not found for Modifier = Modifier, normalLineTextStyle: ERROR CLASS: Symbol not found for TextStyle = LocalTextStyle.current.copy( fontSize = 34.sp, fontWeight = FontWeight.Bold, textMotion = TextMotion.Animated, ), accompanimentLineTextStyle: ERROR CLASS: Symbol not found for TextStyle = LocalTextStyle.current.copy( fontSize = 20.sp, fontWeight = FontWeight.Bold, textMotion = TextMotion.Animated, ), textColor: ERROR CLASS: Symbol not found for Color = Color.White, breathingDotsDefaults: KaraokeBreathingDotsDefaults = KaraokeBreathingDotsDefaults(), blendMode: ERROR CLASS: Symbol not found for BlendMode = BlendMode.Plus, useBlurEffect: Boolean = true, offset: ERROR CLASS: Symbol not found for Dp = 32.dp, showDebugRectangles: Boolean = false, fontResource: ERROR CLASS: Symbol not found for FontResource?? = null, sharedAtlasManager: SdfAtlasManager = rememberSdfAtlasManager(2048, 2048), sharedNativeEngine: NativeTextEngine? = null)

A comprehensive lyrics view that supports Karaoke and Synced lyrics with advanced rendering.

Link copied to clipboard
fun LyricsLineItem(isFocused: Boolean, isRightAligned: Boolean, onLineClicked: () -> Unit, onLinePressed: () -> Unit, blurRadius: () -> Float, modifier: ERROR CLASS: Symbol not found for Modifier = Modifier, activeAlpha: Float = 1.0f, inactiveAlpha: Float = 0.4f, blendMode: ERROR CLASS: Symbol not found for BlendMode = BlendMode.SrcOver, content: () -> Unit)

A container for a single line of lyrics, handling common interactions and animations. Features:

Link copied to clipboard
fun measureSyllablesAndDetermineAnimation(syllables: List<ERROR CLASS: Symbol not found for KaraokeSyllable>, textMeasurer: ERROR CLASS: Symbol not found for TextMeasurer, style: ERROR CLASS: Symbol not found for TextStyle, isAccompanimentLine: Boolean, spaceWidth: Float, fontFamilyResolver: ERROR CLASS: Symbol not found for FontFamily.Resolver, density: ERROR CLASS: Symbol not found for Density, nativeEngine: NativeTextEngine, platformContext: Any? = null): List<SyllableLayout>

Measures all syllables in a line using the native text engine and determines appropriate animation strategies (simple fade/slide vs. complex bounce/swell).

Link copied to clipboard
Link copied to clipboard
fun rememberFontResourceBytes(fontResource: ERROR CLASS: Symbol not found for FontResource??): ByteArray?

Read font bytes from a Compose Multiplatform FontResource. Uses the public LocalResourceReader API.

Link copied to clipboard
Link copied to clipboard
fun SyncedLineText(line: ERROR CLASS: Symbol not found for SyncedLine, isLineRtl: Boolean, textStyle: ERROR CLASS: Symbol not found for TextStyle, textColor: ERROR CLASS: Symbol not found for Color, modifier: ERROR CLASS: Symbol not found for Modifier = Modifier)

Displays a simple lyrics line that is synced to a specific time but has no internal arithmetic/karaoke animation. Typically used for non-karaoke synced lyrics (LRC format).

Link copied to clipboard
fun trimDisplayLineTrailingSpaces(displayLineSyllables: List<SyllableLayout>, nativeEngine: NativeTextEngine, style: ERROR CLASS: Symbol not found for TextStyle, density: ERROR CLASS: Symbol not found for Density): WrappedLine