\documentclass[14pt,twoside]{extarticle}

%
% Proofs and pretty-printed source code for Tsukurimashou
% Copyright (C) 2011, 2012, 2013, 2014  Matthew Skala
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, version 3.
%
% As a special exception, if you create a document which uses this font, and
% embed this font or unaltered portions of this font into the document, this
% font does not by itself cause the resulting document to be covered by the
% GNU General Public License. This exception does not however invalidate any
% other reasons why the document might be covered by the GNU General Public
% License. If you modify this font, you may extend this exception to your
% version of the font, but you are not obligated to do so. If you do not
% wish to do so, delete this exception statement from your version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% Matthew Skala
% http://ansuz.sooke.bc.ca/
% mskala@ansuz.sooke.bc.ca
%

% warning, this page layout must match bkstyle.tex (modulo bleed)

\input{version.tex}

\newif\iftsukudraft\tsukudraftfalse
\input{proofs-draft.tex}

\usepackage{fontspec}
\usepackage[margin=1.25in,top=0.85in,bottom=0.85in,headheight=18pt,%
  papersize={8.5in,11in}]{geometry}
\usepackage{tikz}
\usepackage[rm,medium,center,compact]{titlesec}
\usepackage{tocloft}
\usepackage{xcolor}
\usepackage{xltxtra}

% colors
\definecolor{darkgreen}{rgb}{0,0.35,0}
\definecolor{purplish}{rgb}{0.4,0,0.6}

\usepackage[letterpaper,breaklinks,bookmarks,plainpages=false,
   colorlinks,citecolor=darkgreen,linkcolor=purplish]{hyperref}

\usetikzlibrary{arrows,calc,shapes.callouts,shapes.geometric}

\defaultfontfeatures{Path=../otf/}

\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}

\titlelabel{}
\newcommand{\sectionbreak}{\clearpage}

\setlength{\cftbeforesecskip}{0pt}
\setlength{\cftbeforesubsecskip}{0pt}

\makeatletter
\renewcommand{\@pnumwidth}{2em}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newfontface\kaku[Mapping=tex-text]{TsukurimashouKakuPS}
\newfontface\mincho[Mapping=tex-text]{TsukurimashouMinchoPS}

\newfontface\anbirutekimono[Mapping=tex-text,WordSpace={1,0,0},PunctuationSpace=3]{TsukurimashouAnbiruteki}

\newfontface\kakudemo[WordSpace={1,0,0},PunctuationSpace=3]{TsukurimashouKaku}
\newfontface\minchodemo[WordSpace={1,0,0},PunctuationSpace=3]{TsukurimashouMincho}
\newfontface\dodumdemo[WordSpace={1,0,0},PunctuationSpace=3,%
  RawFeature={+liga,+ljmo,+vjmo}]{MandeubsidaDodum}
\newfontface\batangdemo[WordSpace={1,0,0},PunctuationSpace=3,%
  RawFeature={+liga,+ljmo,+vjmo}]{MandeubsidaBatang}
\newfontface\atamademo[WordSpace={1,0,0},PunctuationSpace=3]{TsuItaAtama}
\newfontface\sokudemo[WordSpace={1,0,0},PunctuationSpace=3]{TsuItaSoku}
\newfontface\cosettedemo[WordSpace={1,0,0},PunctuationSpace=3]{BlackletterLolitaCosette}
\newfontface\seisuudemo[WordSpace={1,0,0},PunctuationSpace=3]{KazoemashouPuruufu}

\setmainfont[Mapping=tex-text,ItalicFont=TsukurimashouMinchoPS]{TsukurimashouKakuPS}
\setmonofont[Mapping=tex-text,WordSpace={1,0,0},PunctuationSpace=3]{TsukurimashouMincho}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\tsukuDemoFonts}{\let\KDF\kakudemo\let\MDF\minchodemo\relax}
\newcommand{\mandeDemoFonts}{\let\KDF\dodumdemo\let\MDF\batangdemo\relax}
\newcommand{\tsuitaDemoFonts}{\let\KDF\atamademo\let\MDF\sokudemo\relax}
\newcommand{\bllDemoFonts}{\let\KDF\cosettedemo\let\MDF\cosettedemo\relax}
\newcommand{\kazoeDemoFonts}{\let\KDF\seisuudemo\let\MDF\seisuudemo\relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\input{pppcount.tex}

\def\ProgressCLine{}

\def\ProgressCheckpoint{\immediate\write18{./wdperl\space
  -CDS\space
  ./wdprogress\space
  count\space
  \jobname}%
  \addtocontents{toc}{\string\ProgressCLine}%
}

\immediate\write18{./wdperl\space
  -CDS\space
  ./wdprogress\space
  start\space
  \jobname\space
  \ProgressCount}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\pagestyle{plain}\thispagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\kaku
\begin{center}\LARGE

\vspace*{\fill}

{\Huge 作りましょう~\TsukurimashouVWide}\\
{\huge パラメタほうしきフォントファミリ\\
校とプリティプリントのソース}

\vspace*{0.75in}

{\Huge Tsukurimashou~\TsukurimashouVersion}\\
{\huge Parametric Font Family\\
Proofs and pretty-printed\\source code}

\vspace*{1.5in}

Matthew Skala\\
mskala@ansuz.sooke.bc.ca\\
\TsukurimashouRDWide\qquad\TsukurimashouReleaseDate

\vspace*{\fill}

\end{center}
\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\vspace*{\fill}

Proofs and pretty-printed source code for Tsukurimashou\\
Copyright © 2011, 2012~~Matthew Skala

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.

As a special exception, if you create a document which uses this font, and
embed this font or unaltered portions of this font into the document, this
font does not by itself cause the resulting document to be covered by the
GNU General Public License. This exception does not however invalidate any
other reasons why the document might be covered by the GNU General Public
License. If you modify this font, you may extend this exception to your
version of the font, but you are not obligated to do so. If you do not
wish to do so, delete this exception statement from your version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see \url{http://www.gnu.org/licenses/}.

\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tableofcontents

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\clearpage

\setlength{\parskip}{0pt}
\small\kaku

\newcommand{\LabelFont}{\anbirutekimono\tiny}

\newcommand{\LineNumber}[1]{\makebox[0pt][r]{\scriptsize #1~}}

\newcommand{\CopyrightNotice}[2]%
  {\LineNumber{#1--#2}\hyperlink{cpynotice}{[Standard copyright notice]}\par}

\newcommand{\FileGroup}[2]%
  {\cleardoublepage\part{#1}\cleardoublepage\def\partarab{#2}}
\newcommand{\File}[1]%
  {\clearpage\section*{#1}\phantomsection\addcontentsline{toc}{section}{#1}}
\newcommand{\Subhead}[2]%
  {\subsection*{#1}\phantomsection\addcontentsline{toc}{subsection}{#1}}

% scaling factor 23.71 by measuring off PDF file
% x1.3 = 30.823

\newcommand{\Picture}[9]{
\hfill
\begin{tikzpicture}[scale=1.3,>=latex']
  \useasboundingbox (#6) rectangle (#7);
  \iftsukudraft
    \draw (#6) rectangle (#7);
    \node at ($(#6)!0.5!(#7)$) {DRAFT};
  \else
    \draw[color=black!50!white,xslant=#8] (#4,-1) grid (#5,9);
    \draw[color=black!50!white,ultra thick,->,xslant=#8] (#4,0) -- (#5,0);
    \draw[color=black!50!white,ultra thick,->,xslant=#8] (0,-1) -- (0,9);
    \fill[color=white] (0,0) circle(0.1);
    \draw[color=black!50!white] (0,0) circle(0.1);
    \draw[inner sep=0pt,anchor=base west,color=blue!30!white]
      (0,0) node{\scalebox{30.823}{\normalsize\KDF #3}};
    \draw[inner sep=0pt,anchor=base west,color=green!70!black,opacity=0.4]
      (0,0) node{\scalebox{30.823}{\normalsize\MDF #3}};
    #9
  \fi
\end{tikzpicture}%
\hspace*{\fill}\par
}

\newcommand{\PBx}[9]%
  {\draw[color=red!80!black,very thick]
    (#2,#3) -- (#4,#5) -- (#6,#7) -- (#8,#9) -- cycle;
   \node[shape=rectangle,color=red!50!black,thick,draw,inner sep=0.05cm,
         anchor=north west] at (#8,#9) {#1};}

\newcommand{\MPt}[2]%
  {\node[diamond,inner sep=0cm,fill,%
   color=green!50!black,text=white] at (#1) {\LabelFont #2};}
\newcommand{\KPt}[2]%
  {\node[diamond,inner sep=0cm,fill,%
   color=blue!50!black,text=white] at (#1) {\LabelFont #2};}
\newcommand{\BPt}[2]%
  {\node[diamond,inner sep=0cm,fill,text=white] at (#1) {\LabelFont #2};}

\newcommand{\MSg}[2]{\draw[very thick,color=green!30!black,->] %
  (#1)--($(#1)!0.52!(#2)$); %
  \draw[very thick,color=green!30!black] ($(#1)!0.48!(#2)$)--(#2);}
\newcommand{\KSg}[2]{\draw[very thick,color=blue!30!black,->] %
  (#1)--($(#1)!0.52!(#2)$); %
  \draw[very thick,color=blue!30!black] ($(#1)!0.48!(#2)$)--(#2);}
\newcommand{\BSg}[2]{\draw[very thick,->] %
  (#1)--($(#1)!0.52!(#2)$); %
  \draw[very thick] ($(#1)!0.48!(#2)$)--(#2);}

\newcommand{\MBl}[2]%
  {\node[star,star point height=0.2cm,inner sep=0cm,fill,%
   color=green!50!black,text=white] at (#1) {\LabelFont #2};}
\newcommand{\KBl}[2]%
  {\node[star,star point height=0.2cm,inner sep=0cm,fill,%
   color=blue!50!black,text=white] at (#1) {\LabelFont #2};}
\newcommand{\BBl}[2]%
  {\node[star,star point height=0.2cm,inner sep=0cm,fill,%
   text=white] at (#1) {\LabelFont #2};}

\newcommand{\Lkr}[2]{}
%  {\draw[densely dotted,very thick,color=red!80!black] (#1)--(#2);}

\newcommand{\Srf}[2]{%
  \node[shape=ellipse callout,color=green!50!black,text=white,fill,%
    callout absolute pointer={(#1)},inner sep=0.05cm] %
    at ($(#1)!0.5cm!180:(3,4)$) {\LabelFont Ｓ#2};
}

\newcommand{\MAn}[9]%
  {\draw[color=red!80!black,thick,->]
    (#2,#3) -- (#4,#5);
   \draw[color=red!80!black,thick,->]
    (#6,#7) -- (#8,#9);
   \node[shape=circle,color=red!50!black,draw,fill=white,
         thick,inner sep=0.01cm] at ($(#2,#3)!0.5!(#4,#5)$) {\LabelFont #1};}

\newcommand{\BAn}[9]%
  {\draw[color=red!80!black,thick,->]
    (#2,#3) -- (#4,#5);
   \draw[color=red!80!black,thick,->]
    (#6,#7) -- (#8,#9);
   \node[shape=circle,color=red!50!black,draw,fill,text=white,
         thick,inner sep=0.01cm] at ($(#2,#3)!0.5!(#4,#5)$) {\LabelFont #1};}

\newcommand{\BlankLine}[1]{\LineNumber{#1}\par}
\newcommand{\BlankLines}[2]{\LineNumber{#1--#2}\par}
\newcommand{\PercentLine}[1]{\LineNumber{#1}\rule[0.5ex]{\linewidth}{1.2pt}\par}
\newcommand{\Comment}[2]{\LineNumber{#1}\%#2\par}
\newcommand{\CodeLine}[2]{\LineNumber{#1}#2\par}
\newcommand{\IlR}[1]{\hfill[see page \pageref{#1}]}

\input{pprinted}

\end{document}
