Hi everyone,
I've released Tategaki 0.2, a small library that sets Japanese text vertically in SwiftUI.
Why
SwiftUI's Text has no vertical writing mode. Tategaki lays text out with Core Text in columns that run top to bottom and stack right to left, and draws it in a view of exactly the size the columns need. It has no dependencies and uses no web view.
What it does
- Vertical columns, with
maxHeightto continue long text in further columns - Ruby (furigana), set in the space between columns, so columns stay evenly spaced with or without it
- Tate-chu-yoko (縦中横): a run of one to four digits set upright in the space of one character, where the font has narrow forms of them
- Emphasis marks (圏点): sesame, dot, circle, or a mark of your own
- Runs with their own font and colour, and colours that follow light and dark appearance
- Selection and copying on macOS, opt-in with
.selectable() - macOS 14+ and iOS 17+, Swift 6 language mode
Example
import SwiftUI
import Tategaki
TategakiText(runs: [
.init("明治"), .init("39", tateChuYoko: true), .init("年、"),
.init("山路", ruby: "やまみち"), .init("を"),
.init("登", ruby: "のぼ"), .init("りながら、こう考えた。"),
.init("とかくに人の世は住みにくい", emphasis: .sesame),
], maxHeight: 330)
What it doesn't do yet
- Selection is macOS only.
- Tate-chu-yoko isn't automatic; you mark the runs.
- Ruby belongs to a run as a whole. A run with ruby that is longer than a column can't be set well, and the library logs a warning when that happens.
- The view takes a
maxHeightrather than sizing itself to the height it's offered. - Line breaking and punctuation are left to Core Text and the font, and haven't been checked against JIS X 4051 or JLREQ.
- It compiles for iOS in CI, but it hasn't been run on an iOS device yet. If you try it there, I'd like to hear how it looks.
Links
- GitHub: GitHub - MacchaCat/swift-tategaki: Vertical Japanese text (縦書き) for SwiftUI, laid out with Core Text · GitHub
- There is a demo app in
Examples/TategakiDemo.
Feedback I'm looking for
- If you know Japanese typesetting: what does the output get wrong? Line breaking, punctuation and ruby placement are where I expect to learn the most.
- Ruby, tate-chu-yoko and emphasis are properties of a run today. Would you rather mark them up in an
AttributedString, or in the text itself? - How would you expect selection to behave on iOS?
Thanks for taking a look!

