
% ==========================================================================================================
%
%      d8b                   .d8888b.   .d8888b.   d888       d8888
%      Y8P                  d88P  Y88b d88P  Y88b d8888      d8P888
%                                  888 888    888   888     d8P 888
%     8888 88888888 888d888      .d88P 888    888   888    d8P  888
%     "888    d88P  888P"    .od888P"  888    888   888   d88   888
%      888   d88P   888     d88P"      888    888   888   8888888888
%      888  d88P    888     888"       Y88b  d88P   888         888
%      888 88888888 888     888888888   "Y8888P"  8888888       888
%      888
%     d88P
%   888P"
%
% ==========================================================================================================

\ProvidesPackage{jzr2014}


% ==========================================================================================================
% Unicode and CJK Handling
% ----------------------------------------------------------------------------------------------------------
\usepackage{fontspec}
% \usepackage{/home/flow/own/tex-packages/xeCJK-2.4.6-r306/xeCJK}
\usepackage{leading}
\usepackage{/Volumes/Storage/io/jizura-xelatex/tex-inputs/utils}
% \usepackage{/Users/flow/JIZURA/flow/dictionary/tex-inputs/accentbx/accentbx}
\usepackage{cxltx-style-accentbox}
\usepackage{cxltx-style-trm}
\usepackage{cxltx-style-pushraise}
\usepackage{pbox}
\usepackage{array}
% \let\footruleskip\undefined\usepackage{fancyhdr}
\usepackage{fixltx2e}
% \usepackage[usenames,dvipsnames,svgnames,table,x11names]{xcolor}

% ==========================================================================================================
% Nifty stuff
% ----------------------------------------------------------------------------------------------------------
% \usepackage{float}
% \usepackage{wrapfig}
% \usepackage{enumitem}
% \usepackage[protrusion=true,final]{/home/flow/own/tex-packages/microtype/microtype} % doesn't work yet
% \usepackage[protrusion=true,final]{microtype} % doesn't work yet
\newcommand{\insertblankpage}{\thispagestyle{empty}\mbox{}\newpage}

% thx to http://tex.stackexchange.com/a/11709/28067
\newcommand*\cleartoleftpage{%
  \clearpage
  \ifodd\value{page}\hbox{}\newpage\fi
}

% ==========================================================================================================
% CJK Glyph Bullets
% ----------------------------------------------------------------------------------------------------------

% \usepackage{tikz}
% \newcommand*\circled[1]{\tikz[baseline=(char.base),line width=0.25mm,blue]{
%             \node[shape=circle,draw,inner sep=0.25mm] (char) {#1};}}

% \usepackage{pstricks}
% \newcommand\circled[1]{%
%   \pscirclebox[boxsep=true]{\makebox[]{}\slash{#1}}%
%   }



% % ==========================================================================================================
% % Drop Caps
% % ----------------------------------------------------------------------------------------------------------
% \usepackage{lettrine}
% \setcounter{DefaultLines}{2}
% \renewcommand{\DefaultLoversize}{-0.0}
% \renewcommand{\DefaultLraise}{0.1}
% \renewcommand{\DefaultLhang}{0.07}
% \setlength{\DefaultFindent}{0.5em}
% \setlength{\DefaultNindent}{0.0em}

% ==========================================================================================================
% General Document Style
% Preliminarily set up to work with document class `article` and will likely change.
% ----------------------------------------------------------------------------------------------------------
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0pt}

\usepackage{jzr2014-fonts}
% \usepackage{xeCJK}
% \setmainfont[Mapping=tex-text]{EB Garamond 12 Regular}
% % \setCJKmainfont{Sun-ExtA}
% \setCJKmainfont{EB Garamond 12 Regular}
% % \newCJKfontfamily\missingFont[Scale=1.10,Color=red]{Sun-ExtA}


% ==========================================================================================================
% Extras
% ----------------------------------------------------------------------------------------------------------
\newcommand{\hirabar}{\hskip0.4ex plus 0.2ex minus 0.2ex%
	\vrule width 0.2mm height 0.7em depth 0.3em%
	\hskip0.8ex plus 0.2ex minus 0.2ex}


% ----------------------------------------------------------------------------------------------------------
\newcommand{\jzrpagenumber}[1]{%
  \py{#1}%
  }%

% ----------------------------------------------------------------------------------------------------------
\newcommand{\jzrpagenumberitalic}[1]{%
  {\pinyinItalicFont #1}%
  }%

% % ..........................................................................................................
% \makepagestyle{jzrshapeclasses}
% \makeevenhead{jzrshapeclasses}{\jzrpagenumber{\thepage}}{\jzrpagenumber{Shapeclasses}}{}
% \makeoddhead{jzrshapeclasses}{}{\jzrpagenumber{Shapeclasses}}{\jzrpagenumber{\thepage}}
% % ..........................................................................................................
% \makepagestyle{jzrguideindex}
% \makeevenhead{jzrguideindex}{\jzrpagenumber{\thepage}}{\jzrpagenumber{Guides}}{}
% \makeoddhead{jzrguideindex}{}{\jzrpagenumber{Guides}}{\jzrpagenumber{\thepage}}
% % ..........................................................................................................
% \makepagestyle{jzrmainpart}
% \makeevenhead{jzrmainpart}{\jzrpagenumber{\thepage}}{\jzrpagenumber{Characters}}{}
% \makeoddhead{jzrmainpart}{}{\jzrpagenumber{Characters}}{\jzrpagenumber{\thepage}}
% % ..........................................................................................................

% ----------------------------------------------------------------------------------------------------------
% \newcommand{\fncr}[2]{%
  % {\lower0.3ex\vbox{\ttFont\hbox{#1}\hbox{#2}}}}
\newcommand{\fncr}[2]{%
  {\fontsize{2.25mm}{2mm}\leading{2mm}\ttFont\lower0.6ex\vbox{\hbox{#1}\hbox{#2}}}}
\newcommand{\fncrB}[2]{%
  {\fontsize{2.25mm}{2mm}\leading{2mm}\ttboldFont\lower0.6ex\vbox{\hbox{#1}\hbox{#2}}}}
% \newcommand{\fncrNG}[3]{%
%   {\fontsize{2.25mm}{2mm}\leading{2mm}\narrowFont\lower0.6ex\vbox{\hbox{#1}\hbox{#2·#3}}}}
\newcommand{\fncrNG}[3]{%
  {\leavevmode%
    {\leading{1mm}%
      \lower0.6ex%
      \vbox to 8.5mm{%
        \vfill%
        \hbox to 8.5mm{%
          \hfil#1\hfil}%
        \vfill%
        \hbox to 8.5mm{%
          \fontsize{2.5mm}{2mm}\narrowFont%
          \hfil#2-#3\hfil}%
        }%
      }%
    }%
  }
\newcommand{\fncrC}[3]{%
  {\leavevmode%
    {\leading{1mm}%
      \lower0.6ex%
      \vbox to \nominalfontsize{%
        \hbox to 10mm{%
          \fontsize{2.8mm}{2mm}\pinyinFont%
          % \hfil%
          #1%
          \hfil}%
        \vfill%
        \hbox to 10mm{%
          \fontsize{2.8mm}{2mm}\pinyinFont%
          % \hfil%
          #2-#3%
          \hfil}%
        % \vfill%
        }%
      }%
    }%
  }
% ..........................................................................................................
\newcommand{\usageCode}[2]{%
  {\fontsize{2.25mm}{2mm}\leading{2mm}\jzrFontUbuntu\lower0.6ex\vbox{\hbox{#1}\hbox{#2}}}}
\newcommand{\usageCodeBold}[2]{%
  {\fontsize{2.25mm}{2mm}\leading{2mm}\jzrFontUbuntuBold\lower0.6ex\vbox{\hbox{#1}\hbox{#2}}}}


% ==========================================================================================================
% STRUTS
% ----------------------------------------------------------------------------------------------------------
\newcommand{\jzrdivider}{\vskip0pt\hrule\vskip-0.4pt}
\newcommand{\jzrdividerinvisible}{\vskip0pt\hrule width0mm\vskip-0.4pt}
\newdimen\nominalfontsize
\newdimen\gridstrutheight
\newdimen\gridstrutwidth
\newdimen\gridstrutdepth
\newdimen\gridstrutlength
\nominalfontsize=5.0mm
\gridstrutheight=6.25mm
\gridstrutwidth=1mm
\gridstrutdepth=1.25mm
\gridstrutlength=\dimexpr\gridstrutheight+\gridstrutdepth
\newcommand{\gridstrut}{{\color{blue}\vrule height\gridstrutheight width\gridstrutwidth depth\gridstrutdepth}}
% \newcommand{\gridstrut}{}
% \newcommand{\gridstrut}{{\color{blue}\rule[\gridstrutdepth]{\gridstrutwidth}{\gridstrutlength}}}



% ==========================================================================================================
% ENVIRONMENTS FOR THE DICTIONARY
% ----------------------------------------------------------------------------------------------------------
% jzrplain
\newenvironment{jzrplain}{%
% ..........................................................................................................
% begin
  % thx to http://www.tug.org/TUGboat/tb28-1/tb88bazargan.pdf for the next two settings:
  \lineskiplimit=-10pt%
  \lineskip=0pt%
  \topskip=0pt%
  \setlength{\parskip}{0mm}%
  \setlength{\parindent}{0mm}%
  % for most fonts:
  % \fontsize{1.028914507\nominalfontsize}{1.028914507\gridstrutlength}%
  % \leading{1.028914507\gridstrutlength}}%
  % for Kaiti:
  \fontsize{1.2\nominalfontsize}{1.2\gridstrutlength}%
  \leading{1.2\gridstrutlength}}%
% end
  {\par}

% jzrliangfang
\newenvironment{jzrliangfang}{%
% ..........................................................................................................
% begin
  % thx to http://www.tug.org/TUGboat/tb28-1/tb88bazargan.pdf for the next two settings:
  \lineskiplimit=-10pt%
  \lineskip=0pt%
  \topskip=0pt%
  \setlength{\parskip}{0mm}%
  \setlength{\parindent}{0mm}%
  \fontsize{2\nominalfontsize}{2\gridstrutlength}%
  \leading{2\gridstrutlength}}%
% end
  {}
  % {\par}

% jzrshuangfang
\newenvironment{jzrshuangfang}{%
% ..........................................................................................................
% begin
  % thx to http://www.tug.org/TUGboat/tb28-1/tb88bazargan.pdf for the next two settings:
  \lineskiplimit=-10pt%
  \lineskip=0pt%
  \topskip=0pt%
  \setlength{\parskip}{0mm}%
  \setlength{\parindent}{0mm}%
  \fontsize{4\nominalfontsize}{4\gridstrutlength}%
  \leading{4\gridstrutlength}}%
% end
  {}
  % {\par}

% ----------------------------------------------------------------------------------------------------------
\newcommand{\emphasizeguide}[1]{%
  % {\color{DodgerBlue4}\addfontfeatures{FakeBold=5.5}#1}}
  {\color{DodgerBlue4}\textbf{#1}}}

% ----------------------------------------------------------------------------------------------------------
\newcommand{\emphasizestrokeclass}[1]{%
  {\colorbox{DodgerBlue4}{\color{white}{\latinBoldFont #1}}}}

% ----------------------------------------------------------------------------------------------------------
\newcounter{jzrglyphcount}

% ==========================================================================================================
% BASE LINE GRID
% ----------------------------------------------------------------------------------------------------------
% \newcommand{\showbaselinegrid}{
%   \usepackage{atbegshi,picture,xcolor}
%   \AtBeginShipout{%
%     \AtBeginShipoutUpperLeft{%
%       \color{red}%
%       \put(\dimexpr 1in+\oddsidemargin,
%            -\dimexpr 1in+\topmargin+\headheight+\headsep+\topskip-\gridstrutdepth-1.255mm)%
%         {%
%          \vtop to\dimexpr\vsize+0mm{
%            \hrule
%            \leaders\vbox to \gridstrutlength{\hrule height0.1pt width\hsize\vfill}\vfill
%          }}}}}




% \newcommand*{\mainentry}[1]{#1\markboth{#1}{#1}}


% ==========================================================================================================
% RULER WIDTHS
% ----------------------------------------------------------------------------------------------------------
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.5mm}
% ----------------------------------------------------------------------------------------------------------


% ==========================================================================================================
% TITLE PAGE
% ----------------------------------------------------------------------------------------------------------
% \usepackage{swrule}
% \hfil\swrule{100mm}{0.5mm}\hfil
% \usepackage[object=vectorian]{pgfornament}
% \newcommand{\sectionline}{%
%   \noindent
%   \begin{center}
%   {\color{DarkViolet}
%     \resizebox{0.5\linewidth}{1ex}
%     {{%
%     {\begin{tikzpicture}
%     \node  (C) at (0,0) {};
%     \node (D) at (9,0) {};
%     \path (C) to [ornament=85] (D);
%     \end{tikzpicture}}}}}%
%     \end{center}
%   }

% % \newcommand{\Huge}[1]{#1}
% \newcommand{\HUGE}[1]{#1}
% % \newcommand{\LARGE}[1]{#1}


\newcommand*{\jzrtitle}{\begingroup% AW, Design of Books
\pagestyle{empty}
\centering
% {\Huge \cn{中日韓文}}\\[\baselineskip]
% {\Huge \cn{字形索引}}\\[\baselineskip]
~\vspace{4\baselineskip}\\
\includegraphics[width=0.75\linewidth]{/Volumes/Storage/temp/french-rule-swell-dash-englische-line/swell-dash.pdf}\\[3\baselineskip]
\par

{\HUGE \textit{The}}\\[0.75\baselineskip]
{\HUGE \scFont Jizura Index}\\[0.75\baselineskip]
{\HUGE \cn{字面索引}}\\[\baselineskip]
{\HUGE \textit{of}}\\[0.75\baselineskip]
{\HUGE \scFont Chinese, Japanese \textit{\&} Korean}\\[0.75\baselineskip]
{\HUGE \scFont \textit{Characters}}\\[3\baselineskip]
\par

\includegraphics[width=0.75\linewidth]{/Volumes/Storage/temp/french-rule-swell-dash-englische-line/swell-dash.pdf}\\[\baselineskip]
\par

\vspace{2\baselineskip}
% {Containing \thejzrglyphcount\ characters}\\[8\baselineskip]
{\LARGE\textit{Containing}}\\[0.25\baselineskip]
{\Huge 9980 characters}\\[0.25\baselineskip]
% {\LARGE\textit{grouped}}\\%[0.5\baselineskip]
% {\LARGE\textit{on geometric principles}}\\%[0.5\baselineskip]
% {\LARGE\textit{by}}\\[0.5\baselineskip]
{\LARGE\textit{grouped on geometric principles by}}\\[0.25\baselineskip]
{\Huge 657 guides}\\[0.25\baselineskip]
{\LARGE\textit{which are divided into}}\\[0.25\baselineskip]
{\Huge 119 shapeclasses}\\[0.25\baselineskip]
{\LARGE\textit{according to their initial strokes}}\\[0.25\baselineskip]
\vfill
\thispagestyle{empty} % repeated here as per http://tug.org/pipermail/macostex-archives/2010-February/043062.html
% {\small\sffamily THE PUBLISHER}\par
\endgroup}



% ..........................................................................................................
% \usepackage{./usecolumndots}
% \usepackage{../tex-inputs/usecolumndots}

% \usepackage[realmainfile,parent]{currfile}
% \expandafter\newcommand{\FILENAME}{\currfilepath}
% \edef\FILENAME{\currfilepath}
% \usepackage{usecolumndots}



% % ==========================================================================================================
% % RULER WIDTHS
% % ----------------------------------------------------------------------------------------------------------
% \setlength{\arrayrulewidth}{0.15mm}
% \setlength{\doublerulesep}{0.5mm}
% % ----------------------------------------------------------------------------------------------------------

% \usepackage{tikz}
% \newcommand\myhline{%
%   \vskip-0.3\baselineskip%
%   \noindent%
%   \tikz[baseline=-.835em]%
%   \draw[blue,dashed](0,0)--(\linewidth-\pgflinewidth,0);
%   \vskip-0.3\baselineskip%
% }
% \newcommand{\divider}{\vskip0pt\hrule\vskip0pt}
% \newcommand{\gridstrut}{\vrule height6mm width1pt depth4mm}

% \usepackage{leading}
% % \usepackage{fancyhdr}
% \usepackage{fixltx2e}
% % \usepackage{tabu}
% % \usepackage{grid}
% \usepackage{multicol}
% \setlength{\columnsep}{1mm}
% \setlength{\columnseprule}{0.15mm}
% % \setlength{\multicolovershoot}{0mm}

% \usepackage[
%   left=10mm,
%   right=20mm,
%   top=8mm,
%   bottom=12mm,
%   headsep=1mm,
%   footskip=5mm,
%   marginparsep=1mm,
%   marginparwidth=14mm,
%   headheight=5mm,
%   includehead,
%   includefoot,
%   paperwidth=210mm,
%   paperheight=297mm]{geometry}
% \newcommand*{\mainentry}[1]{#1\markboth{#1}{#1}}
% \begin{document}
% % \title{The\\Jizura Dictionary\\of\\Chinese\\Japanese\\and\\Korean\\Characters}
% % \author{黎永強}
% % \maketitle
% % \insertblankpage
% % \section{Jizura Dictionary}
% % \setcounter{page}{2}
% % \begin{multicols}{2}
% % \pagestyle{fancy}
% % \begin{foo}

% % \fancyhead[LE,RO]{\leftmark}
% % \fancyhead[LO,RE]{\rightmark}

\newcommand{\paTopLeftSizeMinusOne}[3]{%
  \paTopLeft{#1}{#2}{%
    \fontsize{0.9\nominalfontsize}{0.714\gridstrutlength}\leading{0.714\gridstrutlength}%
    \paGauge{天地玄黃宇宙洪荒日月盈昃辰宿列張}%
    #3}}%

\newcommand{\paTopLeftSizeTwo}[3]{%
  \paTopLeft{#1}{#2}{%
    \fontsize{2.5\nominalfontsize}{2.5\gridstrutlength}\leading{2.5\gridstrutlength}%
    \paGauge{天地玄黃宇宙洪荒日月盈昃辰宿列張}%
    #3}}%
\newcommand{\paTopLeftSizeThree}[3]{%
  \paTopLeft{#1}{#2}{%
    \fontsize{4.2\nominalfontsize}{4.2\gridstrutlength}\leading{4.2\gridstrutlength}%
    \paGauge{天地玄黃宇宙洪荒日月盈昃辰宿列張}%
    #3}}%
\newcommand{\paTopLeftSizeFour}[3]{%
  \paTopLeft{#1}{#2}{%
    \fontsize{5.6\nominalfontsize}{5.6\gridstrutlength}\leading{5.6\gridstrutlength}%
    \paGauge{天地玄黃宇宙洪荒日月盈昃辰宿列張}%
    #3}}%





