feat(compose): font size control #195

Merged
JMR-dev merged 3 commits from feat-73-font-size-control into main 2026-07-03 04:27:55 +00:00
JMR-dev commented 2026-07-03 03:38:41 +00:00 (Migrated from github.com)

Summary

  • Adds a preset font-size dropdown (10 / 12 / 14 / 18 / 24 pt, plus "Default" to clear) to the compose formatting toolbar via a new ui/compose/format/FontSizePicker.kt composable, mirroring the ColorSwatch/ColorSwatchRow picker pattern established in #189.
  • Applies RichStyle.FontSize(pt) over the selection through the existing generalized applyStyle/clearStyle toggle path — no font-size-specific branching in RichTextEditor.kt.
  • The anchor button shows the selection's current size (or "Default" when unset/mixed), matching the "picker shows the selection's current size" acceptance criterion.
  • New toolbar string resources: format_size, format_size_default, format_size_pt.

The rich-text foundation ticket already provided RichStyle.FontSize(pt), its pt/px-tolerant HTML round-trip (RichTextHtml/RichTextHtmlParser), and the pt→sp mapping for in-editor rendering (SpanStyle(fontSize = style.pt.sp)) — all already covered by existing tests in RichTextHtmlTest.kt. This PR wires up the missing UI control.

Closes #73

Test plan

  • :app:assembleDebug
  • :app:testDebugUnitTest — includes a new clearStyle removes a font size span regardless of its value unit test (mirrors the existing FontColor/Highlight clearStyle tests); font-size:Npt HTML round-trip (pt and px parsing) was already covered by RichTextHtmlTest.kt from the foundation ticket.
  • :app:lintDebug
  • :app:ktlintCheck :app:detekt
  • :app:compileDebugAndroidTestKotlin — new FontSizePickerTest.kt (compiled only, not run on-device per policy) exercises the picker in isolation: default label, selected-size label, opening the menu, picking a preset, and picking "Default" to clear.

🤖 Generated with Claude Code

## Summary - Adds a preset font-size dropdown (10 / 12 / 14 / 18 / 24 pt, plus "Default" to clear) to the compose formatting toolbar via a new `ui/compose/format/FontSizePicker.kt` composable, mirroring the `ColorSwatch`/`ColorSwatchRow` picker pattern established in #189. - Applies `RichStyle.FontSize(pt)` over the selection through the existing generalized `applyStyle`/`clearStyle` toggle path — no font-size-specific branching in `RichTextEditor.kt`. - The anchor button shows the selection's current size (or "Default" when unset/mixed), matching the "picker shows the selection's current size" acceptance criterion. - New toolbar string resources: `format_size`, `format_size_default`, `format_size_pt`. The rich-text foundation ticket already provided `RichStyle.FontSize(pt)`, its `pt`/`px`-tolerant HTML round-trip (`RichTextHtml`/`RichTextHtmlParser`), and the pt→sp mapping for in-editor rendering (`SpanStyle(fontSize = style.pt.sp)`) — all already covered by existing tests in `RichTextHtmlTest.kt`. This PR wires up the missing UI control. Closes #73 ## Test plan - [x] `:app:assembleDebug` - [x] `:app:testDebugUnitTest` — includes a new `clearStyle removes a font size span regardless of its value` unit test (mirrors the existing FontColor/Highlight `clearStyle` tests); `font-size:Npt` HTML round-trip (pt and px parsing) was already covered by `RichTextHtmlTest.kt` from the foundation ticket. - [x] `:app:lintDebug` - [x] `:app:ktlintCheck :app:detekt` - [x] `:app:compileDebugAndroidTestKotlin` — new `FontSizePickerTest.kt` (compiled only, not run on-device per policy) exercises the picker in isolation: default label, selected-size label, opening the menu, picking a preset, and picking "Default" to clear. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.