summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ucs/utils/lucenc.def
blob: eb8497abd422fe2b8fbdc0ec2fdd7ef7554ba085 (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
%%
%% This is file `lucenc.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ucs.dtx  (with options: `lucenc.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.
%% 
\catcode`\@11
\ifx\@tempcnta\undefined\csname newcount\endcsname\@tempcnta\fi
\ifx\@tempcntb\undefined\csname newcount\endcsname\@tempcntb\fi
\def\lucchar#1{%
  \begingroup
    \@tempcnta=#1\divide\@tempcnta by"1000
    \multiply\@tempcnta by-"1000\advance\@tempcnta by#1%
    \divide\@tempcnta by"100%
    \@tempcntb=#1\divide\@tempcntb by"10000
    \multiply\@tempcntb by-"10000\advance\@tempcntb by#1%
    \divide\@tempcntb by"1000%
    \xdef\LUC@plane@LUC{%
      \ifcase\@tempcntb0\or1\or2\or3\or4\or5\or6\or7\or
                       8\or9\or a\or b\or c\or d\or e\or f\fi
      \ifcase\@tempcnta0\or1\or2\or3\or4\or5\or6\or7\or
                       8\or9\or a\or b\or c\or d\or e\or f\fi}%
    \ifnum#1>"FFFF
      \@tempcnta=#1\divide\@tempcnta by"100000
      \multiply\@tempcnta by-"100000\advance\@tempcnta by#1%
      \divide\@tempcnta by"10000%
      \xdef\LUC@plane@LUC{%
        \ifcase\@tempcnta0\or1\or2\or3\or4\or5\or6\or7\or
                         8\or9\or a\or b\or c\or d\or e\or f\fi
        \LUC@plane@LUC}%
      \ifnum#1>"FFFFF
        \@tempcnta=#1\divide\@tempcnta by"1000000
        \multiply\@tempcnta by-"1000000\advance\@tempcnta by#1%
        \divide\@tempcnta by"100000%
        \xdef\LUC@plane@LUC{%
          \ifcase\@tempcnta0\or1\or2\or3\or4\or5\or6\or7\or
                           8\or9\or a\or b\or c\or d\or e\or f\fi
          \LUC@plane@LUC}%
      \fi
    \fi
    \@tempcnta=#1\divide\@tempcnta by"100
    \multiply\@tempcnta by-"100\advance\@tempcnta by#1%
    \relax
    %\typeout{Plane: \LUC@plane@LUC, Char: \number\@tempcnta}%
  \expandafter\endgroup
  \expandafter\luc@char\expandafter{\number\@tempcnta}%
}
\def\luc@loadfont{%
  \expandafter\ifx\csname LUC-font-\LUCfont\LUC@plane@LUC\endcsname\relax
    \expandafter\font\csname LUC-font-\LUCfont\LUC@plane@LUC\endcsname=%
      \LUCfont\LUC@plane@LUC\fi
  \csname LUC-font-\LUCfont\LUC@plane@LUC\endcsname}
\def\luc@char#1{%
  \ifx\LUC@plane@LUC\LUC@plane@old\else
    \ifx\LUCfont\undefined\selectfont
    \else\luc@loadfont\fi
  \fi
  \char#1 }
\ifx\NeedsTeXFormat\undefined\endinput\fi

\ProvidesFile{lucenc.def}[2002/02/20 Encoding for Unicode fonts]
\DeclareFontEncoding{LUC}{}{}%
\DeclareFontSubstitution{LUC}{arial}{m}{n}%
\providecommand\LUC@@empty[1]{%
  \edef\mandatory@arg{\mandatory@arg\csname LUC@plane@\f@encoding\endcsname}%
  \empty@sfcnt#1%
  \edef\uc@temp@a{\csname LUC@plane@\f@encoding\endcsname}%
  \xdef\font@name{\csname \curr@fontshape/\f@size/\uc@temp@a\endcsname}}
\providecommand\LUC@@sub[1]{%
  \expandafter\ifx\csname LUC@\mandatory@arg/\f@size\endcsname\relax
  \expandafter\gdef\csname LUC@\mandatory@arg/\f@size\endcsname{}%
  \sub@sfcnt#1%
  \else
  \sub@sfcnt\@gobble
  \fi}
\DeclareSizeFunction{LUC}{\LUC@@empty\@font@warning}
\DeclareSizeFunction{LUCb}{\LUC@@empty\@font@warning}
\DeclareSizeFunction{sLUC}{\LUC@@empty\@font@info}
\DeclareSizeFunction{sLUCb}{\LUC@@empty\@font@info}
\DeclareSizeFunction{LUCsub}{\LUC@@sub\@font@warning}
\DeclareSizeFunction{LUCssub}{\LUC@@sub\@font@info}
\gdef\LUC@plane@LUC{00}%
\DeclareTextCommand{\textascii}{\LastDeclaredEncoding}[1]{\textunicodechar{`#1}}
\DeclareTextCommand{\textunicodechar}{\LastDeclaredEncoding}[1]{\lucchar{#1}}

%%% Local Variables:
%%% mode: latex
%%% coding: utf-8
%%% TeX-master: "../test.tex"
%%% End:
%%% Local IspellDict: british