summaryrefslogtreecommitdiff
path: root/macros/optex/base/uni-lcuc.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/optex/base/uni-lcuc.opm')
-rw-r--r--macros/optex/base/uni-lcuc.opm41
1 files changed, 31 insertions, 10 deletions
diff --git a/macros/optex/base/uni-lcuc.opm b/macros/optex/base/uni-lcuc.opm
index 2a99f52d66..e56b3b9228 100644
--- a/macros/optex/base/uni-lcuc.opm
+++ b/macros/optex/base/uni-lcuc.opm
@@ -1,12 +1,20 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-% Preloaded in format. A copy o uni-lcuc.tex fom csplain is here:
+\_wterm{Setting lccodes and uccodes for Unicode characters <2021-04-07>} % preloaded in format.
-% uni-lcuc.tex -- sets \lccodes and \uccodes for Unicode chars, nothing more
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Petr Olsak, Jul. 2014
+\_isfile{UnicodeData.txt}\_iftrue
+\_begingroup
+ \_sdef{lc:Ll}#1#2#3#4{\_global\_lccode"#2="#2 \_global\_uccode"#2="0#3 }
+ \_sdef{lc:Lu}#1#2#3#4{\_global\_lccode"#2="0#4 \_global\_uccode"#2="#2 }
+ \_sdef{lc:Lo}#1#2#3#4{\_global\_lccode"#2="#2 \_global\_uccode"#2="#2 }
+ \_def\_pa#1;#2;#3;#4;#5;#6;#7;#8;#9;{\_ifx;#1;\_else\_ea\_pb\_fi{#1}{#3}}
+ \_def\_pb#1#2#3;#4;#5;#6;#7;#8 {\_csname lc:#2\_endcsname\_pc{#1}{#6}{#7}\_pa}
+ \_def\_pc#1#2#3{} % ignored if the character hasn't Ll, Lu, nor Lo type
+ \_everyeof={;;;;;;;;;} % end of file
+ \_ea\_pa\_input UnicodeData.txt
+\_endgroup \_endinput \_fi % \endinput here, if UnicodeData.txt was loaded
-\_wterm{Setting lccodes and uccodes for Unicode characters}
+% If UnicodeData.txt not found, we have internal copy here from csplain, 2014:
\_def\_tmp #1 #2 {\_ifx^#1^\_else
\_lccode"#1="#1
@@ -15928,17 +15936,30 @@ E01EF .
% end of file
\_endcode
-All codes in unicode table keep information about pairs lowecase-uppercase
+All codes in Unicode table keep information about pairs lowecase-uppercase
letters or single letter. We need to read such information and set
appropriate `\lccode` and `\uccode`. The `\catcode` above the code 127
is not set, i.\,e.\ the `\catcode`=12 for all codes above 127.
-The file `uni-lcuc.opm` does this work. It is not much interesting file, only
-first few lines from 15928 lines in total is shown here.
+The file `UnicodeData.txt` is read if this file exists in your \TeX/
+distribution. The format is specified
+at \url{http://www.unicode.org/L2/L1999/UnicodeData.html}. We read only `Ll`
+(lowercase letters), `Lu` (upperase letters) and `Lo` (other letters) and
+set appopriate codes. The scanner of `UnicodeData.txt` is implemented here
+in the group (lines 6 to 15). After the group is closed then
+the file `uni-lcuc.opm` is leaved by `\endinput`.
+
+If the file `UnicodeData.txt` does not exsists then internal data are used.
+They follow to the end of the file `uni-lcuc.opm`.
{\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \medskip}\ttline=-1
\def\docfile{uni-lcuc.opm}
-\verbinput (3-30) uni-lcuc.opm
+\verbinput (3-39) uni-lcuc.opm
\vskip-\medskipamount
-\noindent\typosize[8/]\dots etc. (see {\tt\Brown\docfile})
+\noindent\typosize[8/]\dots etc., 15900 similar lines (see {\tt\Brown\docfile})
}
+
+\_endinput
+
+2021-04-07 ... UnicodeData.txt scanner implemented
+2020-03-10 ... released