Post

Wrote a quick blog post about the newest AndroidX library 'androidx.text:text-vertical' 📚✨ Learn about the cool functionality this provides and why this is important, particularly if you read Japanese newspapers 🇯🇵📰 Read more: www.spght.dev/articles/13-... #AndroidDev #AndroidX

spght.devWhats new in... 'AndroidX Text - 1.0.0-alpha01' | Ed Holloway-George | Android Developer | Android GDEA quick look at one of the latest additions to the AndroidX suite of libraries

While I was experimenting with this in one of my apps (an NHK Easy News reader), I realized that, bizarrely, we got official support for ruby text on Android for vertical text before horizontal text 🤪

0 reposts1 like

These are pretty neat! Unfortunately neither has been suitable for my needs. The first only takes a String, so support for styling is very limited. The second is View-based, but this is a Compose Multiplatform app, so I need something purely in Compose.

I've built a custom solution that relies on setting a higher line height (and aligning text to the bottom), and then drawing the furigana in the empty space on top. It's quite messy now and there's some rough edges, but I hope to open source it soon! Here's how this looks (from the app itself):

It's not perfect though; it requires mucking with the original text itself, as sometimes the furigana is longer than the text and I need to insert dummy Unicode non-joining hidden characters to be able to change letter spacing. Works, but sometimes this results in line breaks in the wrong place...