# Tategaki: vertical Japanese text (縦書き) for SwiftUI, with ruby and tate-chu-yoko

**URL:** <https://forums.swift.org/t/tategaki-vertical-japanese-text-for-swiftui-with-ruby-and-tate-chu-yoko/90989>\
**Category:** Community Showcase\
**Tags:** macos, swiftui, ios, swift-package\
**Created:** [November 22, 2026, 3:45pm UTC](https://forums.swift.org/t/tategaki-vertical-japanese-text-for-swiftui-with-ruby-and-tate-chu-yoko/90989 "2026-11-22T15:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MacchaCat](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/macchacat/32/47511_2.png) [@MacchaCat](https://forums.swift.org/u/MacchaCat)\
**Post date:** [November 22, 2026, 3:45pm UTC](https://forums.swift.org/t/tategaki-vertical-japanese-text-for-swiftui-with-ruby-and-tate-chu-yoko/90989/1 "2026-11-22T15:45:38Z")

</div>

Hi everyone,

I've released Tategaki 0.2, a small library that sets Japanese text vertically in SwiftUI.

 ![A paragraph set vertically, with furigana beside the kanji, the digits of a date set upright, and sesame dots beside an emphasised phrase](https://global.discourse-cdn.com/swift/original/3X/c/7/c7729574609516e06e4ec7facd2135ab5a09d92f.png)

**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 `maxHeight` to 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**

```swift
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 `maxHeight` rather 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](https://github.com/MacchaCat/swift-tategaki)
- 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!

---

<div class="post-metadata">

**Author:** ![MacchaCat](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/macchacat/32/47511_2.png) [@MacchaCat](https://forums.swift.org/u/MacchaCat)\
**Post date:** [November 22, 2026, 5:27pm UTC](https://forums.swift.org/t/tategaki-vertical-japanese-text-for-swiftui-with-ruby-and-tate-chu-yoko/90989/2 "2026-11-22T17:27:07Z")

</div>

Update: 0.3.0 adds the punctuation spacing of Japanese typesetting, following three clauses of JLREQ: consecutive marks such as 。「 are closed up (3.1.4), an opening bracket at the top of a column is set flush (3.1.5), and a quarter em separates Japanese text from Latin letters and digits (3.2.6). It's on by default, and `.spacing(.none)` gives the previous layout. Line-end punctuation, hanging punctuation and the strict line-breaking rules aren't done yet.

 ![Before and after: the same sentence with Core Text's spacing and with the spacing rules](https://global.discourse-cdn.com/swift/original/3X/a/6/a6862df7c313592d4b4d826a8cace6ce4b7fcd57.png)
