Skip to content

Commit eb45441

Browse files
committed
recall: play-triangle replay glyph, text presentation, wider inline box
The speaker emoji rendered as a color-emoji glyph that overflows its em box, so the 1.1em inline placeholder clipped it. Switch to a play triangle with U+FE0E (text presentation): it respects font metrics, inherits the content color, and matches the requested affordance. Widen the placeholder to 1.3em for headroom. Fallback aggregate row updated to match.
1 parent 6bebbfe commit eb45441

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

tool/src/main/kotlin/com/dvdutch/recall/ui/NodeComposables.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ private const val AUDIO_NODE_KIND = "audio"
8686
/** Wire value of [ClozeNode.state] for a cloze that is still hidden (question side). */
8787
private const val CLOZE_STATE_HIDDEN = "hidden"
8888

89+
/**
90+
* The inline replay glyph: a PLAY triangle with U+FE0E forcing text presentation, so it
91+
* renders as a font glyph (inheriting the content color, respecting font metrics — no
92+
* emoji-box overflow/clipping) rather than a color emoji.
93+
*/
94+
internal const val AUDIO_GLYPH = "▶︎"
95+
8996
/** The inlineContent id for the audio-replay glyph at track [track] within a text node. */
9097
internal fun audioInlineId(track: Int): String = "audio:$track"
9198

@@ -104,7 +111,7 @@ internal fun audioInlineId(track: Int): String = "audio:$track"
104111
fun textNodeToAnnotatedString(node: TextNode): AnnotatedString = buildAnnotatedString {
105112
for (run in node.runs) {
106113
if (run.audioTrack != null) {
107-
appendInlineContent(audioInlineId(run.audioTrack), "🔊")
114+
appendInlineContent(audioInlineId(run.audioTrack), AUDIO_GLYPH)
108115
continue
109116
}
110117
val style = run.toSpanStyle()
@@ -192,8 +199,9 @@ private fun audioInlineContent(
192199
): Map<String, InlineTextContent> {
193200
val tracks = node.runs.mapNotNull { it.audioTrack }
194201
if (tracks.isEmpty()) return emptyMap()
195-
// Glyph box ~ the line text size; tracks the node scale so it matches shrunken/grown text.
196-
val glyphEm = 1.1f
202+
// Glyph box slightly wider than the line text size (headroom against clipping);
203+
// tracks the node scale so it matches shrunken/grown text.
204+
val glyphEm = 1.3f
197205
return tracks.associate { track ->
198206
audioInlineId(track) to InlineTextContent(
199207
Placeholder(
@@ -213,7 +221,7 @@ private fun audioInlineContent(
213221
contentAlignment = Alignment.Center,
214222
) {
215223
Text(
216-
text = "🔊",
224+
text = AUDIO_GLYPH,
217225
color = LightThemeTokens.colors.content,
218226
style = cardCopyStyle(LightThemeTokens.typography.copy).scaledBy(scale),
219227
)

tool/src/main/kotlin/com/dvdutch/recall/ui/StudyScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ private fun androidx.compose.foundation.layout.ColumnScope.CardBody(
489489
}
490490

491491
/**
492-
* A tappable "🔊 REPLAY AUDIO" row shown only when the current side has audio; a tap
492+
* A tappable "▶︎ REPLAY AUDIO" row shown only when the current side has audio; a tap
493493
* replays that side's list from the start. Monochrome LightText in the design system,
494494
* sitting just above the bottom bar / grade buttons — discoverable but not intrusive.
495495
*/
@@ -503,7 +503,7 @@ private fun ReplayAudioRow(onReplay: () -> Unit) {
503503
horizontalArrangement = Arrangement.Center,
504504
) {
505505
LightText(
506-
text = "🔊 REPLAY AUDIO",
506+
text = "▶︎ REPLAY AUDIO",
507507
variant = LightTextVariant.Fine,
508508
lighten = true,
509509
align = TextAlign.Center,

0 commit comments

Comments
 (0)