summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ucs/utils/c40enc.def
blob: 22a96a9f4414f689f4746a8575f8086df2861336 (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
%%
%% This is file `c40enc.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ucs.dtx  (with options: `c40enc.def')
%% 
%% Copyright 2001 Dominique Unruh  <unruh@ut.ee>
%% Copyright 2013 Wolfgang Jeltsch <wolfgang@cs.ioc.ee>
%% 
%% This program is provided under the terms of the LaTeX Project Public License with some
%% modifications. See the file LICENSE for information.
%% 
\ProvidesFile{c40enc.def}[2002/11/25 Fontencoding C40 (JIS)]%
\DeclareFontEncoding{C40}{}{}%
\DeclareFontSubstitution{C40}{song}{m}{n}%
\input{cenccmn.tex}%
\expandafter\let\csname C40/song/m/n\endcsname\undefined
\def\cjk@Cforty#1#2#3#4{% Takes JIS0208 codepos in hex
  {%
    \count0="#1#2
    \multiply\count0 by94
    \advance\count0 by"#3#4
    \advance\count0 by-"B3F
    \count1\count0
    \divide\count0 by256
    \multiply\count0 by256
    \advance\count1 by-\count0
    \divide\count0 by256
    %\typeout{C0=\number\count0, C1=\number\count1}%
    \edef\temp@a{\ifnum\count0<10 0\fi\number\count0}%
    \edef\temp@b{\ifx\temp@a\CJK@plane\else
      \def\noexpand\CJK@plane{\temp@a}\noexpand\selectfont\fi
      \char\number\count\@ne\space}%
    %\typeout{C40: \meaning\temp@b}%
    \expandafter}\temp@b%
  }%
\DeclareTextCommand\jischar{C40}[1]{\cjk@Cforty#1}
\DeclareTextCommandDefault\jischar[1]{{\fontencoding{C40}%
    \let\CJK@plane\undefined\cjk@Cforty#1}}