OSDN Git Service

microtype
[luatex-ja/luatexja.git] / test / lltjext / test.tex
1 \ifdefined\BASEDIR
2   \documentclass[11pt]{ltjtarticle}
3   \let\BASEDIR=\tate
4 \else
5   \documentclass[11pt]{ltjarticle}
6   \let\BASEDIR=\yoko
7 \fi
8 \usepackage[OT1]{fontenc}
9 \DeclareFontFamily{OT1}{mycmr}{}
10 \DeclareFontShape{OT1}{mycmr}{m}{n}{<-> s*[0.5] cmr10}{}
11 \DeclareFontShape{OT1}{mycmr}{bx}{n}{<-> s*[0.5] cmbx10}{}
12 \def\rmdefault{mycmr}\rmfamily
13 \usepackage[kozuka-pron,nfssonly]{luatexja-preset}
14
15 \newif\ifMATH
16 %\usepackage{plext}
17 \usepackage{xcolor}
18 \usepackage[papersize={182mm,182mm},textwidth=42\zw,lines=30,centering]{geometry}
19
20 \makeatletter
21 \def\set@fontsize#1#2#3{%
22     \@defaultunits\@tempdimb#2pt\relax\@nnil
23     \edef\f@size{\strip@pt\@tempdimb}%
24     \@defaultunits\@tempskipa#3pt\relax\@nnil
25     \edef\f@baselineskip{\the\@tempskipa}%
26     \edef\f@linespread{#1}%
27     \let\baselinestretch\f@linespread
28     \def\size@update{%
29       \baselineskip\f@baselineskip\relax
30       \baselineskip\f@linespread\baselineskip
31       \normalbaselineskip\baselineskip
32       \adjustbaseline
33       \setbox\strutbox\hbox{\yoko
34           \vrule\@width\z@
35                 \@height\dimexpr \cht\@depth\dimexpr \cdp}%
36       \setbox\dstrutbox\hbox{\dtou
37           \vrule\@width\z@
38                 \@height\dimexpr \cht\@depth\dimexpr \cdp}%
39       \setbox\tstrutbox\hbox{\tate
40           \vrule\@width\z@
41                 \@height\dimexpr \cht\@depth\dimexpr \cdp}%
42       \setbox\zstrutbox\hbox{\tate
43           \vrule\@width\z@
44                 \@height\dimexpr \cht\@depth\dimexpr \cdp}%
45      \let\size@update\relax}}
46
47
48
49 \def\G{\expandafter\dimen@\ifnum\ltjgetparameter{direction}=3 \ltjgetparameter{talbaselineshift}\else\ltjgetparameter{yalbaselineshift}\fi\raise-\dimen@}
50 \newbox\adjust@box\newdimen\adjust@dimen
51 \let\orig@adjustbaseline=\adjustbaseline
52 \def\adjustbaseline{\orig@adjustbaseline
53   \setbox\adjust@box\hbox{\char\euc"A1A1}%
54   \cht\ht\adjust@box
55   \cdp\dp\adjust@box
56   \cwd\wd\adjust@box
57   \cvs\normalbaselineskip
58   \chs\cwd
59   \cHT\cht \advance\cHT\cdp
60   \ifnum\ltjgetparameter{direction}=3\relax
61     \setbox\adjust@box\hbox{\ltjsetparameter{talbaselineshift=\z@}M}%
62     \adjust@dimen\ht\adjust@box
63     \advance\adjust@dimen\dp\adjust@box
64     \advance\adjust@dimen-\cHT
65     \divide\adjust@dimen\tw@
66     \advance\adjust@dimen\cdp
67     \advance\adjust@dimen-\dp\adjust@box
68     \ltjsetparameter{talbaselineshift=\adjust@dimen}
69   \else
70     \setbox\adjust@box\hbox{\ltjsetparameter{yalbaselineshift=\z@}M}%
71     \adjust@dimen\ht\adjust@box
72     \advance\adjust@dimen\dp\adjust@box
73     \advance\adjust@dimen-\cHT
74     \divide\adjust@dimen\tw@
75     \advance\adjust@dimen\cdp
76     \advance\adjust@dimen-\dp\adjust@box
77     \ltjsetparameter{yalbaselineshift=\adjust@dimen}
78   \fi}
79 \def\At#1#2{%
80 \setbox0=\hbox{\ifMATH$\fi\tabcolsep\z@%
81   \ifx\BASEDIR\tate\setbox\strutbox=\copy\tstrutbox\fi
82   \setbox0=\hbox{\smash{$\vcenter{\hbox{\vrule height2ptdepth0pt\vrule depth2ptheight0pt}}$}%
83     \begin{tabular}#2[#1]{l}
84       \hline ◆a◆a◆\\ \hline
85     \end{tabular}}%
86   \leavevmode%
87   \textcolor{green!70!black}{%
88     \G\hbox{\vrule width \dimexpr 40pt+\wd0 height.1mm depth 0pt}}%
89   \kern-\dimexpr 40pt+\wd0
90   \textcolor{cyan}{\vrule width \dimexpr 40pt+\wd0 height.1mm depth 0pt}%
91   \kern-\dimexpr 40pt+\wd0 \hbox to20pt{\hss あ%
92   \hbox to 0pt{\textcolor{magenta!50!white}{${\kern\wd0\over\kern20pt}$}}abc}\box0\kern4em%
93   \kern3em%
94   \setbox0=\hbox{%
95     \begin{tabular}#2[#1]{c}
96       ◆\smash{abcde}あいう◆\\◆あいう◆あいう◆\\
97       ◆\smash{abcde}あいう◆
98     \end{tabular}}%
99   \textcolor{green!70!black}{%
100     \G\hbox{\vrule width \dimexpr 20pt+\wd0 height.1mm depth 0pt}}%
101   \kern-\dimexpr 20pt+\wd0
102   \hbox to 0pt{\textcolor{magenta!50!white}{${\kern\dimexpr20pt+\wd0\over\kern20pt}$}}%
103   \textcolor{cyan}{\vrule width \dimexpr 20pt+\wd0 height.1mm depth 0pt}%
104   \kern-\dimexpr 10pt+\wd0\box0\kern10pt%
105 \ifMATH$\fi}\ht0=50pt\dp0=50pt\leavevmode\box0 }
106
107 \def\Ap#1#2{%
108 \setbox0=\hbox{あ\tabcolsep\z@%
109   \ifx\BASEDIR\tate\setbox\strutbox=\copy\tstrutbox\fi
110   \setbox0=\hbox{\parbox#2[#1]{7\zw}{%
111          ◆あいお\hfil xyz ab-cde\hfil あ◇う\break◆◆◆◇◆◆◆\break あいうえおかきえPhy◆}}
112   \leavevmode
113   \textcolor{green!70!black}{%
114     \G\hbox{\vrule width \dimexpr 20pt+\wd0 height.1mm depth 0pt}}%
115   \kern-\dimexpr 20pt+\wd0
116   \textcolor{cyan}{\vrule width \dimexpr 20pt+\wd0 height.1mm depth 0pt}%
117   \kern-\dimexpr 10pt+\wd0 \vrule width.1mmheight30ptdepth30pt
118   \kern-.1mm\box0\kern4em
119   }\ht0=50pt\dp0=50pt\leavevmode\box0 }
120
121
122 \everypar{}
123 \def\LTORIG#1{%
124   \expandafter\newbox\csname lt#1\endcsname
125   \global\expandafter\setbox\csname lt#1\endcsname
126   \vtop{\BASEDIR\normalsize\adjustbaseline\noindent
127         \textbf{\kern5\zw 未読込}
128           \begin{description}
129                 \def\makelabel##1{\hbox to 4em{##1\hss}}
130            \item[Top] \typeout{TTTT}\A{t}{}\typeout{AAAA}
131            \item[Center] \leavevmode\kern4\zw\A{c}{}
132            \item[Bottom] \A{b}{}
133           \end{description}
134   }}
135 \let\A=\At\LTORIG o
136 \let\A=\Ap\LTORIG p
137
138 \def\PLT#1#2{%
139   \expandafter\newbox\csname pl#1#2\endcsname
140   \global\expandafter\setbox\csname pl#1#2\endcsname
141   \vtop{\BASEDIR\normalsize\adjustbaseline\noindent
142   \textbf{開発版
143     \smash{\hbox to1\zw{#2\hss}}\ifMATH 数式\fi}
144   \begin{description}
145   \def\makelabel##1{\hbox to 4em{##1\hss}}
146      \item[Top] \A{t}{<#2>}
147      \item[Center] \leavevmode\kern4\zw\A{c}{<#2>}
148      \item[Bottom] \A{b}{<#2>}
149   \end{description}}}
150
151 \usepackage{lltjext}
152 \let\A=\At
153 \MATHfalse\PLT bn\PLT by\PLT bt \PLT bz
154 \MATHtrue \PLT dn\PLT dy\PLT dt \PLT dz
155 \MATHfalse
156 \let\A=\Ap
157 \PLT cn\PLT cy\PLT ct \PLT cz
158
159 \makeatletter
160 \def\@out#1#2{%
161   \edef\boxname{#1#2}\expandafter\copy\csname \boxname\endcsname}
162
163 \def\OUT#1#2{%
164 \newpage\noindent
165 \rlap{\textcolor{red}{\@out{pl#1}n}}%
166 \rlap{\textcolor{black}{\@out{lt#1}{}}}%
167 \newpage
168 \noindent
169 \rlap{\textcolor{blue}{\@out{pl#2}n}}%
170 \rlap{\textcolor{black}{\@out{lt#1}{}}}%
171 \newpage
172 \noindent
173 \rlap{\textcolor{red}{\@out{pl#1}n}}%
174 \rlap{\textcolor{blue}{\@out{pl#2}n}}%
175 \newpage
176 \noindent
177 \rlap{\textcolor{red}{\@out{pl#1}y}}%
178 \rlap{\textcolor{blue}{\@out{pl#2}y}}%
179 \newpage
180 \noindent
181 \rlap{\textcolor{red}{\@out{pl#1}t}}%
182 \rlap{\textcolor{blue}{\@out{pl#2}t}}%
183 \newpage
184 \noindent
185 \rlap{\textcolor{red}{\@out{pl#1}z}}%
186 \rlap{\textcolor{blue}{\@out{pl#2}z}}%
187 \newpage}
188 \def\OUTNEW#1#2{%
189 \noindent
190 \rlap{\textcolor{#2}{\@out{pl#1}y}}%
191 \newpage
192 \noindent
193 \rlap{\textcolor{#2}{\@out{pl#1}t}}%
194 \newpage
195 \noindent
196 \rlap{\textcolor{#2}{\@out{pl#1}z}}%
197 \newpage
198 }
199 \begin{document}
200 \parindent0pt
201
202 \hbox{\BASEDIR\LARGE\adjustbaseline tabular, array環境}
203 \OUTNEW{b}{blue}
204 \OUTNEW{d}{blue!50!black}
205 %\hbox{\BASEDIR\LARGE\adjustbaseline \texttt{\textbackslash parbox}命令}
206 %\OUT pc
207 \end{document}
208