TextWithReadingCore

fun TextWithReadingCore(formattedText: String, color: Color, style: TextStyle, modifier: Modifier = Modifier, fontSize: TextUnit = TextUnit.Unspecified, fontStyle: FontStyle? = null, fontWeight: FontWeight? = null, fontFamily: FontFamily? = null, letterSpacing: TextUnit = TextUnit.Unspecified, textDecoration: TextDecoration? = null, textAlign: TextAlign? = null, lineHeight: TextUnit = TextUnit.Unspecified, overflow: TextOverflow = TextOverflow.Clip, softWrap: Boolean = true, maxLines: Int = Int.MAX_VALUE, minLines: Int = 1, onTextLayout: (TextLayoutResult) -> Unit? = null, furiganaEnabled: Boolean = true, furiganaGap: TextUnit = TextUnit.Unspecified, furiganaFontSize: TextUnit = TextUnit.Unspecified, furiganaLineHeight: TextUnit = TextUnit.Unspecified, furiganaLetterSpacing: TextUnit = TextUnit.Unspecified)

The core composable for displaying text with optional furigana (phonetic readings).

This function renders the given formattedText along with its readings (if any and if furiganaEnabled is true), positioning the furigana above the corresponding characters. This is especially useful for displaying Japanese kanji with phonetic guides.

All standard text styling parameters behave similarly to androidx.compose.material3.Text. If you are setting your own style, consider using LocalTextStyle and TextStyle.copy to retain theme-based defaults.

Parameters

formattedText

The text to be displayed. May include furigana data formatted like [漢字[かんじ]].

furiganaEnabled

Whether to enable the furigana. If false, normal text component will be used.

furiganaGap

Space between the main text and the furigana. If unspecified, uses style.fontSize * 0.03f.

furiganaFontSize

Font size for the furigana text. If unspecified, style.fontSize * 0.45f.

furiganaLineHeight

Line height for the furigana text. If unspecified, uses furiganaFontSize * 1.2f.

furiganaLetterSpacing

Letter spacing for the furigana text. If unspecified, uses -style.fontSize * 0.03f.

modifier

Modifier to apply to the layout.

color

Text color. If Color.Unspecified, falls back to style.color or LocalContentColor.

style

Text style configuration such as font, color, line height, etc.

fontSize

Font size for the main text.

fontStyle

Typeface variant to use (e.g., italic).

fontWeight

Font thickness to use (e.g., FontWeight.Bold).

fontFamily

Font family to use.

letterSpacing

Space to add between letters.

textDecoration

Decorations to apply (e.g., underline).

textAlign

Alignment of text within the paragraph.

lineHeight

Line height in TextUnit (e.g., sp or em).

overflow

How to handle visual overflow.

softWrap

Whether to wrap at soft line breaks.

maxLines

Maximum number of lines to display. Required: 1 <= minLines<= maxLines.

minLines

Minimum number of visible lines. Required: 1 <= minLines<= maxLines.

onTextLayout

Callback triggered when a new text layout is calculated.