# Writing scenarios

## 4. Vertical writing and NVL

Vertical writing is the traditional Japanese layout, where text runs from top to bottom in columns.

| How to write it | Meaning |
|---|---|
| `@vertical on` / `@vertical off` | Switch to vertical writing, or back to horizontal |
| `ui.message.vertical: true` in liminalia.json | Make the whole game vertical |
| `@nvl on` | NVL (text piles up across the whole screen) |
| `@nvl on style=letter` | Show NVL with a named look from `ui.nvlStyles` in liminalia.json |

In vertical writing:

- Lines advance from right to left, and ruby goes to the right of the characters.
- If the position and size of the message window aren't set, the window is placed on the right of the screen, taller than it is wide.
- In NVL, paragraphs pile up from the right. When they overflow, older paragraphs flow off to the right and disappear (punctuation hanging past the end of a line isn't cut off).
- Balloons (`@balloon`) stay horizontal.

Switching between vertical and horizontal clears the text on screen (the same goes for switching NVL with `@nvl`). Whether the text is vertical is kept in the state, so loading gives the same screen.

**The NVL look, and looks for each scene**

Write the NVL look in `ui.nvl`. For scenes where the text is written on "another sheet," like letters, documents or a terminal screen, write named looks in `ui.nvlStyles`
and switch with `@nvl on style=name`. The text stays ordinary dialogue and narration, so it goes into the backlog, read marks, skipping, voice, translation and the wording checks as usual.

```json
"ui": {
  "nvl": { "background": "rgba(6, 8, 12, 0.72)" },
  "nvlStyles": {
    "letter": { "background": "#efe6d2", "image": "paper/letter.png", "color": "#3a2a1a", "font": "serif", "valign": "top", "padding": [96, 220, 80, 220], "fade": 400, "names": false }
  }
}
```

```
@nvl on style=letter
Dear friend, how are you?
The autumn wind is already blowing here.
@nvl off
```

| Item | Meaning |
|---|---|
| `background` | The background (a color or gradient; dark and translucent by default) |
| `image` | A picture laid over the background (from `image`; cropped to fill the screen, on top of the background color) |
| `padding` | The space around the text (px. One value for all four sides, or four for top, right, bottom, left; 72, 150, 96, 150 by default) |
| `align` | Line alignment (`left`, `center`, `right`) |
| `valign` | Where paragraphs pile up (`top` from the top, `center` in the middle, `bottom` from the bottom, pushing older paragraphs up; `bottom` by default) |
| `font` `color` `size` `lineHeight` | The font (the font the player chose in Settings comes first), text color, size (px; the player's text size is applied) and line height |
| `fade` | A fade when each paragraph appears (milliseconds; none by default. Not while skipping or when redrawing after a load) |
| `names` | Whether to show the speaker's name at the start of a paragraph (`true` by default) |

- A named look is laid over `ui.nvl`, only for the items written. `@nvl on` without `style=` goes back to the `ui.nvl` look. The look's name is kept in the state, so loading gives the same look
- A name that isn't in `ui.nvlStyles` is an error in the syntax check (`unknown-nvl-style`)

Appearance settings:

| Setting | Meaning | Default |
|---|---|---|
| `ui.text.rubySize` | Ruby size (a multiple of the base text) | 0.45 |
| `ui.text.paragraphGap` | Space between NVL paragraphs (a multiple of the text size) | 0.5 |
| `ui.text.emphasis` | Shape of emphasis dots (CSS `text-emphasis-style`) | `filled sesame` |
| `ui.text.quotes` | The outer brackets and quotation marks of dialogue. `keep` shows them as written. `strip` removes the outer pair (`「…」` `『…』` `“…”` `"…"`) and shows only what's inside (below) | `keep` |

How `ui.text.quotes: "strip"` removes them:

- They're removed only when the first character of the text is an opening mark and its matching closing mark is the last character. Text that closes partway through, such as `「あ」「い」` or `"a" and "b"`, text that isn't closed, and text with ruby or `{= expression}` at either end are left as they are.
- `（…）` and `(…)` stay, because they mark inner thoughts. Nested brackets (the `『』` in `「『夢』だった」`) stay too.
- If there's a translation, they're removed from the translated text. It works the same in the message window, NVL, the backlog, `@balloon` balloons and regular dialogue on the chat screen.
- The chat screen removes `「…」` and `『…』` even with `keep` (the speech bubble takes the place of the brackets).
- You can set it per language (`ui.languages.en.text.quotes`; for example, show brackets in the Japanese original and remove quotation marks in the English translation). It stays when you switch themes.
