% This is the file CJKvert.sty of the CJK package
%   for vertical typesetting.
%
% created by Werner Lemberg <wl@gnu.org>
%
% Version 4.7.0 (17-Oct-2006)

% Copyright (C) 1994-2006  Werner Lemberg <wl@gnu.org>
%
% 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; either version 2 of the License, or
% (at your option) any later 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 in doc/COPYING; if not, write to the Free
% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
% MA 02110-1301 USA

\def\fileversion{4.7.0}
\def\filedate{2006/10/17}
\ProvidesPackage{CJKvert}[\filedate\space\fileversion]

\RequirePackage{graphicx}


% we suppress any unwanted spaces produced by linefeeds.

\endlinechar \m@ne


\newif\ifCJK@vertical@
\CJK@vertical@false

\newcommand{\CJKvert}{
  \CJK@vertical@true
  \gdef\CJK@direction{v}
  \renewcommand\baselinestretch{1.3}
  \normalfont}

\newcommand{\CJKhorz}{
  \CJK@vertical@false
  \gdef\CJK@direction{h}
  \renewcommand\baselinestretch{1}
  \normalfont}

\CJKvert


% we redefine \CJKsymbol so that pseudo bold characters will be shifted
%     vertically, not horizontally.
%
% for fonts without vertical representation forms, some glyphs shouldn't
%     be rotated; \CJKsymbolsimple can be then used for a redefinition in
%     the `.fdx' file.

\newcommand{\CJKsymbolsimple}[1]{
  \edef\CJK@temp{\csname \CJK@enc/\CJK@family/simpleoffset\endcsname}
  \expandafter\ifx\CJK@temp \relax
    \edef\CJK@temp{0pt}
  \fi
  \ifCJK@bold@
    \raise \CJK@temp \hbox{\symbol{#1}}
    \raise \CJK@temp \hbox to \z@{\hss \raise\CJKboldshift\hbox{\symbol{#1}}}
    \raise \CJK@temp \hbox to \z@{\hss \raise-\CJKboldshift\hbox{\symbol{#1}}}
  \else
    \raise \CJK@temp \hbox{\symbol{#1}}
  \fi
}

\DeclareRobustCommand{\CJKsymbol}[1]{
  \ifCJK@vertical@
    \expandafter\ifx\csname \CJK@enc/\CJK@family/norotate/v\endcsname \relax
      \edef\CJK@tempa{\csname \CJK@enc/\CJK@family/offset/v\endcsname}
      \expandafter\ifx\CJK@tempa \relax
        \edef\CJK@tempa{0pt}
      \fi
      \edef\CJK@tempb{\csname \CJK@enc/\CJK@family/fullheight/v\endcsname}
      \expandafter\ifx\CJK@tempb \relax
        \def\CJK@temp{\rotatebox[x=\CJK@tempa]{90}{\symbol{#1}}}
      \else
        \edef\CJK@tempc{\csname \CJK@enc/\CJK@family/height/v\endcsname}
        \expandafter\ifx\CJK@tempc \relax
          \edef\CJK@tempc{0pt}
        \fi
        \setbox\@tempboxa\hbox{\symbol{#1}}
        \ht\@tempboxa \CJK@tempc
        \@tempdima\CJK@tempb
        \advance\@tempdima -\CJK@tempc
        \dp\@tempboxa \@tempdima
        \def\CJK@temp{
          \rotatebox[x=\CJK@tempa]{90}{\copy\@tempboxa}}
      \fi
    \else
      \def\CJK@temp{\symbol{#1}}
    \fi
    \ifCJK@bold@
      \CJK@temp
      \hbox to \z@ {\hss \raise\CJKboldshift\hbox{\CJK@temp}}
      \hbox to \z@ {\hss \raise-\CJKboldshift\hbox{\CJK@temp}}
    \else
      \CJK@temp
    \fi
  \else
    \ifCJK@bold@
      \symbol{#1}
      \hbox to \CJKboldshift{\hss\symbol{#1}}
      \hbox to \CJKboldshift{\hss\symbol{#1}}
    \else
      \symbol{#1}
    \fi
  \fi}


% reset endline character.

\endlinechar `\^^M

\endinput
