かんたんな説明
1912年の中国の新聞の2ページです。文字は上から下へ読む行で組まれ、昔の新聞と同じく、ページを上下に積んだ帯に分けて、そのあいだに線を引きます。
できあがり
中華民国元年にあたる1912年、新聞がまだ縦に組まれていたころの中国の新聞2面です。本文は上海の『申報』から取りました。西湖の宴席に招かれた孫文(孫中山)、その席で演説に異を唱えて立ち上がり、もう一度立ち上がって詫びた陳其美。南京攻略で戦死した浙江の兵士の追悼。杭州が帰還した軍のために建てた凱旋記念碑。臨時政府の公報の創刊号から取った電報4通が囲みを埋めます。本文は25字の2段(欄)で、段のあいだに罫を引き、電報は3段に組みます。第1面は朱色の題字と、ページの高さいっぱいに縦に組んだトップ記事の見出しで始まります。同じページを横組みで作る例が新聞の第1面です。
このレシピが答える質問
- 中国語の新聞のページを、罫線で区切った段で縦組みにするには?
- 章タイトルをページ幅いっぱいに置き、その下で本文を2段組みにするには?
- Postextは3段以上の段組みや、画像の周りへの回り込みに対応していますか?
- 版面を字数で設定し、1行の字数と1ページの行数を決めるには?
手短な答え
// On a vertical page two columns are two tiers (欄), stacked and filled from the upper right:
// the gutter is the gap between them, the column rule a rule across the page.
const layout = {
layoutType: 'double', writingMode: 'vertical-rl', // binding 'auto' becomes 'right'
gutterWidth: pt(2 * BODY),
columnRule: { enabled: true, color: col('ink'), lineWidth: pt(0.75) },
};
// The grid counts characters down a tier and lines across the page: 25 × 29.
const cjk = { grid: { enabled: true, charsPerLine: CHARS, linesPerPage: 29 } };
// The body stays in two tiers. The telegrams take three inside a page-span box floated to
// the foot of the flow, the left of the sheet, with the fences
// :::callout{type="wires" span="page" placement="bottom" title="電報"} and :::columns{count=3}
const wires = { id: 'wires', backgroundEnabled: false,
stripe: { enabled: true, side: 'top', width: pt(1.5), color: col('ink') }, // on its right
padding: { top: pt(6), right: pt(0), bottom: pt(0), left: pt(0) },
columnGap: pt((HEIGHT - 3 * 18 * 9) / 2), // three tiers of 18 characters of 9 pt
titleStyle: { fontFamily: HEI, fontSize: pt(12), fontWeight: 700, color: col('accent') },
body: { fontFamily: SONG, fontSize: pt(9), lineHeight: pt(13.5), textAlign: 'justify',
firstLineIndent: pt(0), boldFontWeight: 700 } };
材料
- 機能
- 1段組みと2段組み段間罫デザインした章扉縦組み右綴じの本文字グリッド囲みの中や本文中の段組み段抜きの囲みフロートする囲み見出しスタイル見出しの属性ページデザインのテキスト・罫・ボックス柱とノンブルページの役割ごとの柱段落スタイル中国語・日本語・韓国語のフォント中国語の約物の幅セマンティックカラーパレットPDFの書き出しPDFに埋め込むフォント
- 種類
- Noto Serif TC, Noto Sans TC, LXGW WenKai TC (SIL OFL 1.1)
- 素材
- なし:画像はすべてコードで描画
作り方
#1 · 2段組みを上下の2段に変える
コードは上の手短な答えにあります。writingMode: 'vertical-rl'では、ページは横組みのページを90°回したものになります。そのためlayoutType: 'double'は2つの段を上下に積み(先に読むのは上の段)、段間の罫はページを横切る罫として段のあいだに入ります(縦組み)。文字グリッドは各段を五號(10.5 pt)の25字、新聞の段としては長めの字詰めにし、ページを29行にします。段間は2字分に丸め、段が余白の中央に来るように余白を広げます(文字グリッド)。
本文は2段のままで、3段が要るのは電報だけなので、電報は囲みに入れます。span="page"で囲みを版面と同じ高さにし、placement="bottom"で流れの末尾、つまり縦組みのページでは左端へフロートとして配置し、:::columns{count=3}で段に分けます。columnGapは、版面の546 ptから9 ptの18字の段3つ分を引いた残りなので、どの段にも字がちょうど整数個入ります。

#2 · 題字とトップ見出しを1つのデザインに入れる
// A page-span heading always opens a page (gotcha: page-span-heading-new-page), so the lead
// story's H1 carries the masthead in its own design, above its headline.
const MAST = 6.5 * LEAD; // the masthead's block, across the page
const block = (id, inset, style) => ({ kind: 'box', id, style,
placement: at(inset, inset, { size: { width: pt(HEIGHT - 2 * inset),
height: pt(MAST - 2 * inset) } }) });
const BAND = 13 * LEAD; // the whole design: masthead, headline, deck
const front = { enabled: true, minHeight: pt(BAND), slot: { elements: [
block('field', 0, { backgroundColor: col('accent') }), // the name reversed out of it
block('frame', 3.5, { borderColor: col('paper'), borderWidth: pt(0.75) }),
text('name', '{title}', KAI, 700, 64, 'paper', { lineHeight: 1, letterSpacing: pt(6),
placement: at(22, 13) }),
text('kicker', '{subtitle}', HEI, 700, 12, 'paper', { placement: at(24, 82) }),
text('sources', '錄{author}', HEI, 400, 8.5, 'paper', { placement: at(150, 84) }),
text('issue', '{attr.issue}', HEI, 700, 12, 'paper', { placement: at(330, 33) }), // the year
text('edition', '{attr.edition}', HEI, 400, 8.5, 'paper', { placement: at(330, 84) }),
text('sheet', '第{pageNumber}張', HEI, 700, 10, 'accent', { placement: at(HEIGHT - 58, 80),
box: { backgroundColor: col('paper'), padding: { top: pt(3), right: pt(3),
bottom: pt(3), left: pt(3) } } }),
// The headline down both tiers, centred; the dateline heads the deck's line.
text('head', '{titleText}', SONG, 900, 44, 'ink', { align: 'center', lineHeight: 1.1,
placement: at(0, MAST + 12, fill) }),
text('deck', '{attr.deck}', KAI, 400, 15, 'ink', { align: 'center',
placement: below('head', 6, fill) }),
text('dateline', '{attr.dateline}', HEI, 700, 9, 'muted', { placement: below('head', 10) }),
{ kind: 'rule', id: 'foot', direction: 'horizontal', thickness: pt(0.75),
color: col('ink'), placement: at(0, BAND - 3, fill) },
] } };
トップ記事の見出しは、題字の下で両方の段を横切る必要がありました。span: 'page'の見出しはページの頭に置く章扉として組まれるので、題字の後にもう1つ置くと、そこから新しいページが始まってしまいます。そこでページのH1をトップ記事にし、その見出しスタイルで見出しの上に題字を描きます。題字は6.5行分の深さの朱色のブロックで、紙名を白抜きにし、その下に号数の行を置きます。号数の行には民国の年と干支の年、そして「本日は2枚発行」を意味する今日出紙兩張が入ります。その後に見出しが44 ptのNoto Serif TC 900で続きます。流れの中ではデザインの幅が紙面上の版面の高さになるので、size: { width: 'fill' }とalign: 'center'で見出しは両方の段にまたがって中央にそろいます。デザインの深さは13行で、グリッド線の整数倍なので、その後の本文はグリッドの行から始まります。

#3 · 各記事を見出しデザインで始める
const storyHead = { enabled: true, minHeight: pt(4 * LEAD), slot: { elements: [ // 4 lines
{ kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.5), color: col('rule'),
placement: at(0, 0, fill) },
text('head', '{titleText}', SONG, 900, 20, 'ink', { placement: at(0, 6) }),
text('deck', '{attr.deck}', KAI, 400, 11, 'ink', { // two characters down the tier
placement: below('head', 4, { offset: { x: pt(2 * BODY), y: pt(4) } }) }),
text('dateline', '{attr.dateline}', HEI, 700, 9, 'muted', { placement: below('deck', 4) }),
] } };
段の中に置く見出しデザインは、その段の中に収まります。罫は流れの中でdirection: 'horizontal'なので、紙面では段を縦に走り、2つの記事のあいだの細罫になります。見出しは段の頭から、脇見出しは2字下げて始まり、日付行には発信地、紙名、記事が載った日が入ります。minHeightで各見出しの深さを4行に保つので、どの見出しの下でも本文はグリッドから始まります。
#4 · 第2面に柱を付け、地に奥付を入れる
// The header's frame is the margin above the tiers; the footer's, the margin below them.
const above = (y, extra = {}) => ({ anchor: { to: 'container', edge: 'top-left' },
offset: { x: pt(0), y: mm(HEAD - y) }, ...extra });
const header = { elements: [
text('title', '{title}', KAI, 700, 14, 'ink', { align: 'right', placement: above(13, fill) }),
text('sheet', '第{pageNumber}張', HEI, 700, 9, 'ink', { placement: above(10.8) }),
{ kind: 'rule', id: 'rule', thickness: pt(1.5), color: col('ink'), placement: above(6, fill) },
].map((element) => ({ ...element, pages: 'body' })) }; // page 1 has the masthead instead
const footer = { elements: [text('colophon', '{attr.colophon}', HEI, 400, 7, 'muted', {
pages: 'body', placement: at(0, 17, fill) })] }; // 6 mm under the tiers
clreqにあるとおり、縦組みのページでも柱は横組みのままです。ヘッダーの枠は段の上の余白です。グリッドがこの余白を広げるので、HEADはグリッドと同じ合計をくり返し計算し、罫が最初の文字の6 mm上に来るようにします。pages: 'body'により、1ページは題字に任せます。奥付はH1の属性なので、英語版とスペイン語版は同じ中国語のページの下に、それぞれ自分の行を印刷します。
#5 · 書体ごとに、その書体で組むテキストを読み込む
const pick = (pattern) => (markdown.match(pattern) ?? []).join('');
const attrs = (...keys) => pick(new RegExp(`[{ ](?:${keys.join('|')})="[^"]*"`, 'g'));
const voices = [ // family, weights, the text it sets, and whether it runs down a column
[SONG, ['400'], markdown, true], // the text
[SONG, ['700', '900'], pick(/^#+ [^{\n]*|\*\*[^*]+\*\*/gm), false], // heads, labels
[HEI, ['400', '700'], pick(/^(?:subtitle|author): .*$|style="source"\}[^:]*/gm) // masthead,
+ attrs('dateline', 'issue', 'edition', 'title', 'colophon') + '錄第一二張', true], // datelines
[KAI, ['400'], attrs('deck') + pick(/style="inscription"\}[^:]*/g), true], // decks, the stele
[KAI, ['700'], pick(/^title: .*$/m), false], // the paper's name
];
Fontsourceはこれらの書体の各ウェイトをおよそ100個のファイルに分けて配信しており、loadCjkFontsはテキストが使うファイルだけを取得します。Noto Serif TC 400にはサンプル全体を渡します。その700と900には見出しと電報のラベルだけ、Noto Sans TCには題字の行、日付行、奥付、LXGW WenKai TCには脇見出し、碑文、紙名を渡します。渡したテキストが足りない書体があるとキャプチャーは失敗し(C12)、別の書体から借りた文字を挙げます。
レシピの全体
// ═══ Postext Cookbook · Nº 084 · A vertical newspaper page in tiers ═══════════════
// https://postext.dev/en/cookbook/vertical-newspaper-tiers
// Code: MIT · Text: Shenbao, 1912 (PD); gazette, stele report: zh.wikisource (CC BY-SA 4.0)
// Fonts: Noto Serif TC, Noto Sans TC, LXGW WenKai TC (SIL OFL 1.1) · Needs postext ≥ 1.46.2
import {
buildDocument, withLoadedFonts, renderPageToCanvas, loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the colophon; the news is Chinese in both editions
const RECIPE = 'vertical-newspaper-tiers';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: newsprint, ink and the vermilion of the masthead
const palette = {
ink: '#1c1a17', // text, the rules between tiers
accent: '#b0281c', // the one accent: the masthead block, the telegrams' flag
rule: '#8f887c', // the hairline before each story
muted: '#5e574e', // datelines, sources, the colophon
paper: '#f7f2e6', // newsprint, and the masthead's type reversed out of the vermilion
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion
const [SONG, HEI, KAI] = ['Noto Serif TC', 'Noto Sans TC', 'LXGW WenKai TC']; // 宋, 黑, 楷
const BODY = 10.5; // pt: 五號, the body size of the papers of 1912
const LEAD = 15.75; // pt: the line pitch across the page, 1.5 em
const CHARS = 25; // characters down a tier: a newspaper column, 17 to 25
const HEIGHT = 2 * CHARS * BODY + 2 * BODY; // pt: two tiers and a gutter of two ems
const TRIM = { w: 184, h: 260 }; // mm, 16開
const MARGIN = { top: 30, bottom: 22, side: 11 }; // mm, minimums: the grid centres the tiers
// The grid grows the margins evenly, so the tiers start HEAD mm below the top edge.
const HEAD = MARGIN.top + (TRIM.h - MARGIN.top - MARGIN.bottom - (HEIGHT * 25.4) / 72) / 2;
// #region answer: two tiers down the page with a rule between them, three inside a box
// On a vertical page two columns are two tiers (欄), stacked and filled from the upper right:
// the gutter is the gap between them, the column rule a rule across the page.
const layout = {
layoutType: 'double', writingMode: 'vertical-rl', // binding 'auto' becomes 'right'
gutterWidth: pt(2 * BODY),
columnRule: { enabled: true, color: col('ink'), lineWidth: pt(0.75) },
};
// The grid counts characters down a tier and lines across the page: 25 × 29.
const cjk = { grid: { enabled: true, charsPerLine: CHARS, linesPerPage: 29 } };
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#電報を4段にする
同じ高さに14字の段が4つ収まり、囲みは必要な行数まで狭くなります。
- columnGap: pt((HEIGHT - 3 * 18 * 9) / 2), // three tiers of 18 characters of 9 pt
+ columnGap: pt((HEIGHT - 4 * 14 * 9) / 3), // four tiers of 14 characters of 9 ptMarkdownでは:::columns{count=4}にします。
#記事を1段で組む
52字の1段が版面の高さいっぱいに走り、紙面ではどの行も193 mmの長さになります。記事の見出しはそれぞれページ全体の4行を占め、2面は3面になります。
- layoutType: 'double', writingMode: 'vertical-rl', // binding 'auto' becomes 'right'
+ layoutType: 'single', writingMode: 'vertical-rl', // binding 'auto' becomes 'right'グリッドではcharsPerLine: 2 * CHARS + 2にします。
よくあるつまずき
つまずき
ページ幅の見出しは必ず新しいページを始める
階層やスタイルでspan: 'page'を設定した見出しは、breakBeforeの有無にかかわらず、ページの頭の章扉として組まれます。ほかのテキストのあとや、同じページの別の章扉のあとに置くと、次のページに移り、現在のページの残りは空になります。題字の下で両段(縦組みのページなら上下両段)にまたがる大見出しは、題字と並べて章扉自身のデザインに入れるか、spanを指定しない見出しとして:::callout{span="page"}の囲みに入れてください。newspaper-front-pageの大見出しはこの方法で組んでいます。 デザインした章扉 →
つまずき
中国語の書体はcjkブロックを通じてスライス単位で読み込む
Fontsourceは中国語、日本語、韓国語のファミリーを、ウェイトごとに約100個のファイルとして配信し、各ファイルが文字の範囲を受け持ちます。loadFontsが取得するのはlatinファイルだけなので、画面では漢字がシステムの書体で出て計測が狂い、fontsourceProviderはPDFにそのlatinファイルを渡すため、漢字が空の四角で印字されます。キットのcjkブロックを挙げ、loadFontsのあとにloadCjkFonts(FONTS, markdown)を呼び(本で複数のCJK書体を使うときは、それぞれの書体で組むテキストを渡して書体ごとに1回)、renderToPdfにfontProvider: cjkPdfProviderを渡してください。どちらもテキストの文字を含むファイルを取得します。 中国語・日本語・韓国語のフォント →
つまずき
文書のタグはLANGではなくzh-Hansかzh-Hantにする
レシピの版はenとesですが、中国語のサンプルはどちらの版でも中国語です。`locale: LANG`では英語やスペイン語とタグ付けされ、ラテン文字の語がハイフネーションされ、図にFigureやFiguraの表示名が付き、PDFの言語も誤ります。postext 1.30以降、このタグはテキストを組む言語(計測、描画、埋め込みに使う言語)でもあるので、英語やスペイン語のタグでは、中国語のフォントの数字と、ラテン文字のテキストと共通の約物が別の字形になり、改行の位置も変わります。タグは自分で書いてください。'zh-Hans'(中国本土の慣習:GBの改行規則、開明式の約物)または'zh-Hant'(台湾:全角で中央に置く約物)、香港なら'zh-HK'です。単なる'zh'は簡体字、本土として読まれます。日本語のサンプルには'ja'を使います(つまずき「ja-locale-tag」)。 中国語の改行 →
つまずき
右綴じの本の見開きはshowBookで表示する
右綴じの本(アラビア語、ヘブライ語、ペルシア語のテキスト、縦組みの中国語、またはpage.binding 'right')でも1ページは奇数ページですが、背の左側に来て、見開きは[3 | 2]と並びます。showPagesはどの本も左綴じとして並べます。bookブロックのshowBook(cjkブロックにも同じ関数があります)はdoc.bindingを読み、見開きを左右反転します。capture.heroでは、見開きは引き続き読む順の[偶数ページ, 奇数ページ]、つまり[2, 3]と指定します。 右綴じの本 →
- FontsourceのNoto Serif TCは、『申報』が印刷した字形である爲を、あるファイルの範囲に含むと宣言していますが、そのファイルにはこの字のグリフがありません。Canvasはシステムの書体で描き、PDFにはこの字が入りませんでした(C25)。記事では為を使っています。
- Wikisourceの翻刻には、このページで直した誤りがあります。宴席の記事では已紀が己紀に、陪侍が2か所とも倍侍になっています。追悼の記事の勸勵一番現在將土は、士が土になり、目的語が一番の後に来ているので、ここでは勸勵現在將士一番(「居合わせた将兵を励ました」)と組みます。異体字4つも標準の字形にしています。寗を寧に、電報では縂を總に(3か所)、决を決に(2か所)、碑文では刋を刊にしました。
- Fontsourceが配信するLXGW WenKai TCは為を爲の形で描きます。そのため楷書体の碑文には、宋体のテキストにない古い字形が現れます。
- 囲みの3段は版面を3等分したもので、本文の2段とはそろいません。新聞ではこうした欄を独自のグリッドで組みます。囲みの右辺の罫が2つのグリッドを分けています。
クレジット
- 本文
- Shenbao (Shanghai), 11 December 1912: the banquet for Sun Yat-sen at West Lake, Hangzhou · Shenbao; transcription by Wikisource editors · パブリックドメイン
- Shenbao (Shanghai), 4 December 1912: the memorial for the Zhejiang soldiers killed at Nanjing · Shenbao; transcription by Wikisource editors · パブリックドメイン
- Shenbao (Shanghai), 17 July 1912: the victory monument at West Lake, with Tang Shouqian's inscription · Shenbao, Tang Shouqian; transcription and punctuation by Wikisource editors, revised for this recipe · CC BY-SA 4.0
- Four telegrams from Linshi zhengfu gongbao (Provisional Government Gazette) no. 1, 29 January 1912 · Provisional Government, Nanjing; transcription and punctuation by Wikisource editors · CC BY-SA 4.0
- Punctuation of the first two reports, the masthead, decks and datelines · Postext Cookbook · CC BY 4.0
- フォント
- Noto Serif TC (SIL OFL 1.1) · Noto Sans TC (SIL OFL 1.1) · LXGW WenKai TC (SIL OFL 1.1)


