本文へスキップ
レシピ番号197

レシピ集 · 第10章 · 出力と組み込み

上製本の表紙、カバーと見返し

並製本のページをクロス装の上製本に仕立て直します。ISBNの違う版を一つ足し、buildCoverで表紙、カバー、前後の見返しを作ります。

このページの内容
出力
Canvas · PDF
レベル
上級
Postext
Postext 1.92.0で検証済み
1.92.0以上が必要 · postext-pdf ≥ 1.92.0
ライセンス
2026年11月23日更新
コードMIT · 本文CC BY 4.0
  • 英語の見本:日本語版はまだありません
  • 仕上がり120 × 190 mm
  • 1段
  • Crimson Pro 11/15.2
  • Cormorant Garamond
  • Josefin Sans
  • 41ページ
  • レベル
  • Postext 1.92.0
  • 組版時間189 ms
  • コード239行

かんたんな説明

ベッケルの二つの伝説を、今度はハードカバーにします。板紙をくるむクロス、その外に巻く紙のカバー、表紙の内側に貼る絵入りの紙です。ページはそのままで、版ごとに展開図とISBNが付きます。

できあがり

袖付き並製本に入れたベッケルの二つの伝説を、もう一度綴じて120 × 190 mmの上製本にします。37ページはそのままです。この本には版が二つになり、それぞれに製本の仕方とISBNがあります。上製本の版からは、製本所に渡す展開図が四枚出ます。表紙は濃い緑のクロス張りで、表表紙と背に書名と著者名を金箔で押します。カバーには絵、紹介文、バーコード、二つの袖が入ります。表紙の内側には絵入りの見返しが二枚。前はドゥエロ川の上のソリア、後ろは二つ目の伝説の泉です。

このレシピが答える質問

  • 並製と同じ本の上製版で、表紙、カバー、見返しを作るには?

手短な答え

script.js · 29〜55行コード全体で見る
// The paperback is Nº 196's, on the printer's own profile. The hardcover takes the built-in
// flat-spine case; `flaps` on a case means a dust jacket, and `caseMaterial: 'cloth'` a case
// covered in cloth and stamped, under the jacket. Spines, boards and turn-ins come from the
// laid-out pages on the paper of `folio.paper`.
const production = {
  bindings: [{ id: 'pur-flaps', name: 'PUR perfect binding, 60 mm flaps', style: 'perfect',
    signature: 16, measures: { flapWidth: 60, bleed: 3, spineAllowance: 0.5 } }],
  versions: [
    { id: 'paperback', name: t({ en: 'Paperback', es: 'Rústica' }), binding: 'pur-flaps',
      flaps: true, isbn: '978-84-0000-196-4', isbnAddOn: '90000' },
    { id: 'hardcover', name: t({ en: 'Hardcover', es: 'Cartoné' }), binding: 'case-flat',
      flaps: true, caseMaterial: 'cloth', isbn: '978-84-0000-197-1', isbnAddOn: '90000' },
  ],
};
// 100 g/m² bulky cream wove at a bulk of 2.4: each leaf is 100 × 2.4 = 240 µm thick.
const folio = { paper: { type: 'bookWove', grammage: 100, bulk: 2.4, shade: '#f7f1e3' } };
// The book's cover design (the paperback's, the jacket's): a night ground and the painting
// on the front panel, into the bleed, whatever the panel's width. `sheets` gives the
// hardcover's other sheets a design of their own: the case its cloth, each endpaper its
// painting across both leaves.
const cover = { background: col('night'), verticalAlign: { back: 'middle' },
  image: { resourceId: 'moncayo', area: 'front', focus: { x: 0.5, y: 0.4 } },
  sheets: {
    case: { background: col('cloth') },
    endpaperFront: { image: { resourceId: 'soria' } },
    endpaperBack: { image: { resourceId: 'fuente' } },
  } };

材料

種類
Crimson Pro, Cormorant Garamond, Josefin Sans (SIL OFL 1.1)
素材
  • fuente-1300.jpg
  • moncayo-1100.jpg
  • soria-1300.jpg
  • The dust jacket: a ruined chapel under the Moncayo on All Souls’ Night, in oils (Generated With Diffusion Models, オリジナル)
  • The front endpaper: Soria above the Duero at dusk, with the Mountain of the Spirits (Generated With Diffusion Models, オリジナル)
  • The back endpaper: a spring among poplars on the slopes of the Moncayo by moonlight (Generated With Diffusion Models, オリジナル)

作り方

#1 · 本文は一つ、版は二つ

コードは上の手短な答えにあります。二つの版は同じfolio.paperと同じ組み上がったページを読みます。37ページは16ページ折3折に切り上げられ、240 µmの紙が24枚です。並製本は糊の分を足して背幅6.3 mm。上製本はさらに2 mmの板紙を2枚足して、背幅10.3 mmになります。ISBNは版ごとに一つで、どちらもどの本にも割り当てられていない出版社記号の見本番号です。背を角背にしたのは、6 mmに満たない本文は丸背にするには薄すぎるからです。case-roundにすると3 mm足して丸背にします。表紙をクロス(cloth)にしたのは、絵も文字もバーコードもカバーに載っていて、その下は箔押しの書名で足りるからです。

#2 · 表紙:くるみ、溝、チリ

script.js · 545〜562行コード全体で見る
// One call per sheet, with the same config and the same cover text: each sheet takes its
// design from `cover.sheets` (the jacket, the book's) and the frames meant for it. The
// barcode goes on the jacket alone, the sheet a till scans.
const built = {};
for (const sheet of ['cover', 'jacket', 'endpaperFront', 'endpaperBack']) {
  const made = buildCover({ config, sheet, pages: book.pages, version: 'hardcover',
    markdown: coverText, metadata: book.metadata, resources });
  if (!('config' in made)) throw new Error(made.issues.map((i) => i.kind).join(', '));
  // The barcode's digits name OCR-B, which no font server has: set in the label face.
  for (const [id, bytes] of Object.entries(made.files)) {
    await loadSvg(id, new TextDecoder().decode(bytes)
      .replace(/font-family="[^"]*"/g, 'font-family="Josefin Sans"'));
  }
  built[sheet] = made;
}
const sheetDoc = (b) => buildDocumentWithFonts(b.content, b.config, kitFonts(FONTS));
const caseDoc = await sheetDoc(built.cover);
const jacketDoc = await sheetDoc(built.jacket);

並製本の表紙は仕上がり寸法で断ち、袖を小口で折り込みます。上製本の表紙は二枚の板紙をくるむ表装材です。板紙は背の側でページより7 mm狭く切り、天、地、小口でページから3 mm出します(チリ)。そのため116 × 196 mmになります。板紙と背のあいだには7 mmの溝があり、表紙はそこで曲がります。周りには15 mmのくるみが付いて板紙の縁に折り返されるので、クロスの地は286.3 × 226 mmの展開図いっぱいまで広がります。

どの展開図も同じconfigと同じ表紙の文章から作ります。表紙のデザインはcover.sheets.caseから取り、クロスの地色だけです。文字はsheet="case"を付けたフレームから取ります。表表紙と背には書名、副題、著者名が入り、case-のスタイルはカバーのスタイルを金色にしたものです。裏表紙には空のフレームを置いて、クロスに内容紹介が入らないようにします。バーコードはレジで読み取るカバーにだけ刷られます。

#3 · カバーは表紙のデザインと文章をそのまま使う

script.js · 59〜81行コード全体で見る
const style = (id, fontFamily, size, lead, color, extra) => ({ id, fontFamily, fontSize: pt(size),
  lineHeight: pt(lead), color, italicColor: color, firstLineIndent: mm(0), textAlign: 'left',
  hyphenation: false, ...extra });
const caps = (tracking) => ({ fontWeight: 600, textTransform: 'uppercase',
  letterSpacing: pt(tracking) });
const coverStyles = [
  style('cover-title', 'Cormorant Garamond', 40, 40, col('bone'), { fontWeight: 600,
    textAlign: 'center', marginTop: mm(12) }),
  style('cover-subtitle', 'Cormorant Garamond', 15, 19, col('bone'), { italic: true,
    textAlign: 'center' }),
  style('cover-author', 'Josefin Sans', 8.5, 11, col('gold'), { ...caps(1.8),
    textAlign: 'center', marginTop: pt(16) }),
  style('cover-spine', 'Josefin Sans', 7.5, 9, col('bone'), { ...caps(1.2), textAlign: 'center' }),
  style('cover-blurb', 'Crimson Pro', 10.5, 14.5, col('bone'), { marginBottom: pt(7) }),
  style('cover-note', 'Crimson Pro', 10.5, 14.5, col('gold'), { italic: true }),
  style('flap-head', 'Josefin Sans', 7.5, 10, col('gold'), caps(1.4)),
  style('flap-text', 'Crimson Pro', 9.6, 13.2, col('bone'), { marginTop: pt(5) }),
];
// The case's frames (`sheet="case"` in the cover text) set the jacket's lines in gold, the
// colour the cloth is stamped in.
const stamped = coverStyles.filter((s) => /title|subtitle|author|spine/.test(s.id))
  .map((s) => ({ ...s, id: s.id.replace('cover-', 'case-'), color: col('gold'),
    italicColor: col('gold') }));

カバーにはcover.sheetsの項目がないので、本のcoverとsheetのないフレームを使い、段落スタイルも表紙のMarkdownも並製本と同じです。表紙用のフレームはここでは外されるので、表の面と背にはメタデータの文字が入ります。面は広くなり、板紙一枚と溝、さらに板紙の縁に回る3 mmで、合わせて126 mmです。袖はページ幅の3分の2の80 mmになり、これがカバーの標準値です。絵は表の面を折り目まで埋め、バーコードは書店が読み取る裏の面に入ります。

#4 · 二枚の見返しを一つの文書に

script.js · 566〜572行コード全体で見る
// Both endpapers are the size of two pages: one document holds them, a page each, the
// back's template renamed so the two templates do not share an id.
const [ef, eb] = [built.endpaperFront, built.endpaperBack];
const back = { ...eb.config.pageTemplates.at(-1), id: 'endpaper-back' };
const endpapers = await buildDocumentWithFonts({ ...ef.content, markdown: `${ef.content.markdown}`
  + `\n\n${eb.content.markdown.replace('postext-cover', back.id)}` },
{ ...ef.config, pageTemplates: [...ef.config.pageTemplates, back] }, kitFonts(FONTS));

見返しはページ二つ分の幅があります。片方は板紙に貼り付け、もう片方の遊び紙はページと同じようにめくれます。前見返しでは貼る側が左、後ろ見返しでは右に来ます。展開図はどちらも246 × 196 mmで、天、地、外側に3 mmの塗り足しがあり、折り目にはありません。折り目には5 mmの糊しろがあり、ここで本文に貼り付けます。折り目が通るので、どちらの絵も中央を静かにしてあります。二枚は同じ寸法なので、一つの文書に1ページずつ収めます。どちらの絵もcover.sheetsにあるそれぞれの見返しのデザインで、2枚の紙にまたがって入ります。

レシピの全体

Sandbox
// ═══ Postext Cookbook · Nº 197 · A hardcover's case, dust jacket and endpapers ═══
// https://postext.dev/en/cookbook/hardcover-jacket-and-endpapers
// Code: MIT · Text: Bécquer, tr. C. F. & K. L. Bates (public domain) · Art: diffusion models
// Fonts: Crimson Pro, Cormorant Garamond, Josefin Sans (SIL OFL 1.1) · Needs postext ≥ 1.92.0
//
// The pages of Nº 196 bound two ways: the paperback with flaps, and a cloth hardcover in a
// dust jacket with painted endpapers. Each version has its binding and its ISBN; buildCover
// makes each sheet of the hardcover from the same laid-out pages.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, inlineSvgFonts,
} from 'https://esm.sh/postext';
import { buildCover } from 'https://esm.sh/postext/production';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'hardcover-jacket-and-endpapers';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// The last four colours are the covers': the jacket's night, gold and bone, the case's cloth.
const palette = { ink: '#25221e', accent: '#86472a', muted: '#6b645a', paper: '#fbf7ee',
  night: '#16242a', gold: '#c99b4e', bone: '#eee5d1', cloth: '#22362f' };
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: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];

// #region answer: two versions over the same pages, each with its binding and its ISBN
// The paperback is Nº 196's, on the printer's own profile. The hardcover takes the built-in
// flat-spine case; `flaps` on a case means a dust jacket, and `caseMaterial: 'cloth'` a case
// covered in cloth and stamped, under the jacket. Spines, boards and turn-ins come from the
// laid-out pages on the paper of `folio.paper`.
const production = {
  bindings: [{ id: 'pur-flaps', name: 'PUR perfect binding, 60 mm flaps', style: 'perfect',
    signature: 16, measures: { flapWidth: 60, bleed: 3, spineAllowance: 0.5 } }],
  versions: [
    { id: 'paperback', name: t({ en: 'Paperback', es: 'Rústica' }), binding: 'pur-flaps',
      flaps: true, isbn: '978-84-0000-196-4', isbnAddOn: '90000' },
    { id: 'hardcover', name: t({ en: 'Hardcover', es: 'Cartoné' }), binding: 'case-flat',
      flaps: true, caseMaterial: 'cloth', isbn: '978-84-0000-197-1', isbnAddOn: '90000' },
  ],
};
// 100 g/m² bulky cream wove at a bulk of 2.4: each leaf is 100 × 2.4 = 240 µm thick.
const folio = { paper: { type: 'bookWove', grammage: 100, bulk: 2.4, shade: '#f7f1e3' } };
// The book's cover design (the paperback's, the jacket's): a night ground and the painting
// on the front panel, into the bleed, whatever the panel's width. `sheets` gives the
// hardcover's other sheets a design of their own: the case its cloth, each endpaper its
// painting across both leaves.

組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)

アレンジ

#クロスを張らずに表紙を印刷する

cover.sheetsからcaseを消すと、表紙は本のデザインを使います。夜の地色で、表表紙に絵が入ります。表紙用のフレームは引き続き書名を金色で組みます。

   sheets: {
-    case: { background: col('cloth') },
     endpaperFront: { image: { resourceId: 'soria' } },

#丸背にする

もっと厚い本なら、case-roundで表紙の背が3 mm広がり、カバーの背もそれに合わせて広がります。

-    { id: 'hardcover', name: t({ en: 'Hardcover', es: 'Cartoné' }), binding: 'case-flat',
+    { id: 'hardcover', name: t({ en: 'Hardcover', es: 'Cartoné' }), binding: 'case-round',

よくあるつまずき

  • キャプチャしたページの並びでは、展開図は本のページの後に来ます。表紙が38、カバーが39、見返しが40と41です。本が1ページ増えると、番号がすべてずれます。
  • 上製本ではsheet="cover"は並製本の表紙と同じく上製本の表紙も指し、sheet="case"は上製本の表紙だけを指します。ある展開図用のフレームは、その展開図でだけ同じゾーンの共通フレームに代わります。空にすればそのゾーンには何も入りません。

クレジット

レシピ
Ignacio Ferro
本文
画像
  • The dust jacket: a ruined chapel under the Moncayo on All Souls’ Night, in oils · Generated With Diffusion Models · オリジナル
  • The front endpaper: Soria above the Duero at dusk, with the Mountain of the Spirits · Generated With Diffusion Models · オリジナル
  • The back endpaper: a spring among poplars on the slopes of the Moncayo by moonlight · Generated With Diffusion Models · オリジナル
フォント
Crimson Pro (SIL OFL 1.1) · Cormorant Garamond (SIL OFL 1.1) · Josefin Sans (SIL OFL 1.1)
SandboxPDF