Skip to content
Yota Nakamura edited this page May 17, 2021 · 27 revisions

ZINE-TEMPLATE概要

出力画像

ZINEのPDFを書き出したいときに使えるプログラムです. Processing IDEで動作します.

1ページ分はA4サイズ(裁ち落としなし),見開きでは2ページ分でA3サイズ(裁ち落としなし)での書き出しを想定しています. いくつかの配置テンプレートをまとめています.


使用するフォント

デフォルトで使用するフォントは以下です. フォントをインストールした上で実行してください.


使い方

実行すると,コードとZINE-TEMPLATE/ZineTemplate/data/に置かれたデータを使い,ZINE-TEMPLATE/ZineTemplate/output/にPDFを1ページずつ書き出します.

1つ1つのページは,ZineTemplate.pde内のgeneratePages()内に処理を書いて生成します.配置テンプレートについては,他のページで説明しています.

public ArrayList<Page> generatePages() {
  // 中略
  // こんな感じで追加する
  pages.add( new CoverSpreadLeft(Section.chap1_sec1_cover) ); // 1章1節見開き表紙左
  pages.add( new CoverSpreadRight(Section.chap1_sec1_cover, color(#FFFFFF), null) ); // 1章1節見開き表紙右
  pages.add( new DescriptionPage(Section.chap1_sec1, "description/") ); // DescriptionPageの例
  // 中略
  return pages;
}

初期設定

PDF書き出しの有効化/無効化

PDFを書き出すときは,ZineTemplate.pdeの以下の記述をtrueにしてください. デフォルトはtrueです.

boolean isExportPDF = true; // 全ページをPDFとして出力

ページ配置の変更

書き出す時のページ配置を選べます.

  • A3サイズ:2ページを横に並べて書き出す
  • A4サイズ:1ページだけ書き出す

2ページを横に並べるときは,ZineTemplate.pdeの以下の記述をtrueにしてください. デフォルトはtrueです.

boolean isTwoSheets = true; // 2ページを横に並べて,見開き1ページとして表示

基準グリッドの表示/非表示

レイアウトの基準となるグリッドを用意しています.

グリッド画像

背景にグリッドを表示する場合は,ZineTemplate.pdeの以下の記述をtrueにしてください. デフォルトはfalseです.

boolean isVisibleGrid = false; // 描画の基準として使用する水色のグリッドを,背景に表示

著者情報の設定

Author.pde内の,執筆者の役割を示すクラスRole内の項目を追加/削除してください.役割を追加する場合はrole5(あくまで一例)などとして追加します.

role1("役割1"),
role2("役割2"),
role3("役割3"),
role4("役割4");

次にAuthor.pde内の,著者リストを表すクラスAuthor内の項目を追加/削除してください.著者を追加する場合はauthor7(あくまで一例)などとして追加します.

author1("執筆者1", "author1", "執筆者1の所属", new Role[]{ Role.role1, Role.role2, Role.role3 }),
author2("執筆者2", "author2", "執筆者2の所属", new Role[]{ Role.role1, Role.role2, Role.role3 }),
author3("執筆者3", "author3", "執筆者3の所属", new Role[]{ Role.role1, Role.role2, Role.role3 }),
author4("執筆者4", "author4", "執筆者4の所属", new Role[]{ Role.role1, Role.role4 }),
author5("執筆者5", "author5", "執筆者5の所属", new Role[]{ Role.role1, Role.role4 }),
author6("執筆者6", "author6", "執筆者6の所属", new Role[]{ Role.role1, Role.role4 });

章/節情報の設定

ZineTemplate.pdeにあるパスを表す変数を,必要に応じて追加/削除してください.

// Sectionのenum内で使うパス
static String cover_path = "cover/";
static String foreword_path = "foreafter/foreword/";
static String contents_path = "contents_table/";
static String chap1_path = "chapter1/";
static String sec1_path = "section1/";
static String afterword_path = "foreafter/afterword/";
static String colophon_path = "colophon/";
static String backcover_path = "backcover/";

Section.pde内の,章/節のリストを表すクラスSection内の項目を追加/削除してください.先ほどのパスを表す変数を使って,パスを設定してください.

cover(cover_path, "表紙", new Author[]{ Author.author1 }),
foreword(foreword_path, "まえがき", new Author[]{ Author.author1 }),
contents(contents_path, "目次", new Author[]{ Author.author1 }),
chap1_cover(chap1_path + cover_path, "1章", new Author[]{ Author.author1, Author.author2, Author.author3, Author.author4, Author.author5, Author.author6 }),
chap1_sec1_cover(chap1_path + sec1_path + cover_path, "1章1節表紙", new Author[]{ Author.author1 }),
chap1_sec1(chap1_path + sec1_path, "1章1節", new Author[]{ Author.author1 }),
afterword(afterword_path, "あとがき", new Author[]{ Author.author1, Author.author2, Author.author3, Author.author4, Author.author5, Author.author6 }),
colophon(colophon_path, "奥付", new Author[]{ Author.author1 }),
backcover(backcover_path, "裏表紙", new Author[]{ Author.author1 }),
empty("", "", new Author[]{});

配置テンプレート

各配置テンプレートは,classとして作っています(DescriptionPage.pdeのように,各pdeファイルに書いています). Pageクラス(Page.pde)を継承して作っています.

命名規則は以下です.

役割 クラス名 命名例
文章を書くページ DescriptionPage DescriptionPage
画像だけのページ LargeImagePage LargeImagePage2
文章と画像が配置されるページ [クラス名] + [画像の枚数] DescriptionPage12
コードを載せるページ [クラス名] + Code DescriptionPage1Code
各画像のサイズが異なるページ [クラス名] + mini + [サイズが異なる画像の枚数] DescriptionPage2mini1

文章を書くページ

画像だけのページ

文章と画像が配置されるページ

コードを載せるページ