summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/CJK/CJKvert.sty
blob: 092171d18ca2abc22788f5c98e1c13bec06cd9a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% 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