Travis Griggs
02/07/2024, 8:18 PMRow(modifier = heightMod) {
// wish there was a simpler way to do this,
// put in a dummy (0 width) text with the full height style, and then baseline align our fitted text to it
// alignByBaseline is only available in a Row
// I wish I could just interrogate the line height info directly from the style and then do the baseline adjust there
Text("", style = style, modifier = Modifier.alignByBaseline())
Text(
text = text,
modifier = Modifier.alignByBaseline(),
style = fittedStyle,
overflow = fittedOverflow,
softWrap = false,
maxLines = 1
)
}
The inline comments pretty much asks the question. Is there not a more simply way to do this? I'd rather wrap it in a box and add an offset than have to generate a dummy entry.Kirill Grouchnikov
02/07/2024, 9:08 PMTextMeasurer
would give you a TextLayoutResult
with firstBaseline
Travis Griggs
02/07/2024, 9:41 PM