%% luaplain.ini -- luaTeX with csplain
%% Petr Olsak  2013
%% ------------------------------------
%% You can generate the luaplain format:  luatex -ini luaplain.ini
%% See the end of this file for more information
 
\catcode`\{=1 \catcode`\}=2  \catcode`\#=6

%% We will skip the \font section in plain.tex file. 
%% In order to do this we temporary re-define the \font primitive:
   \let\orifont=\font
   \long\def\font#1\ttfam=\tentt{}   % skip the font section from plain.tex
   \let\rm=\relax \let\tenex=\relax  % some macros are set to temporary meaning
   \def\mit{\fam1 } \def\cal{\fam2 } % some macros are set by plain TeX  
   \def\it{\fam\itfam\tenit} \def\sl{\fam\slfam\tensl} 
   \def\bf{\fam\bffam\tenbf} \def\tt{\fam\ttfam\tentt}
   \def\oldstyle{\fam1 \the\textfont1 } 

%% \outer macros do problems only, no profit:
   \let\outer=\relax

%% plain TeX macros are loaded now (including hyphenation pattern 0):
   \input plain    % format Plain

%% LuaTeX initialisation:
   \input luatexiniconfig.tex 

%% Next base macros:
   \input plaina4     % \hsize and \vsize for A4
   \def\font#1 {}     % ignore \font\tenbi=csbxti10
   \input csfontsm    % macros: \sizespec, \resizefont, \resizeall, \tenbi, \bi
   \let\font=\orifont % original meaning of the font
   \input ucode       % extra codes for czech / slovak letters in Unicode
   \def\fontfeatures{mode=base;script=latn;+tlig}
   \input lmfonts     % Latin Modern fonts preloaded in Unicode
   \let\fontfeatures=\undefined

%% Hyphenation patterns loading:
   % \let\allpatterns=y  % uncomment this if you needd all patterns
   % \let\deUnicode=y    % uncomment this if you need only en+cs+sk+de patterns 
   \let\onlyUnicode=y    % comment this if you need Iso+Cork+Unicode patterns
   \input hyphen.lan 

%% We need to reaload the otfload lua code:
   \def\font{\input luafonts \global\let\font=\orifont \font}

%% Default output format:
   \input luatex85.sty  % backward compatibility with pdfTeX
   \input pdftexconfig  % pdfTeX configuration
   \pdfoutput=1

\everyjob={%
   \message{The format: luaplain based on csplain <Nov. 2013>.}%
   \message{Unicode internal encoding is set.}%
   \message{Latin Modern fonts + ams-math are preloaded and A4 size implicitly defined.}%
   \message{\the\numpatterns\space hyphenation patterns are preloaded
            (see \string\pattlist), \string\enlang\space is default.}}

\dump

==================== Comments ========================

You can generate your LuaTeX format based o csplain by:

   luatex -ini luaplain.ini

and use it by:

   luatex -fmt luaplain document

You can create an alias "luaplain = luatex -fmt luaplain" in your system.
You can modify this file for your needs without limitation.

Here is a test:

   \chyph
   Ahoj světe, toto je česky napsaný text zpracovaný v Unicode.
   \end

Try to process it by ``luaplain document''.

The main reason of this format: user needn't to write lines   

   \input ucode
   \input lmfonts

at the beginning of his/her document. The document processed by csplain
(with encTeX and pdfTeX) should give the same result as processing it by   
luaplain.

Warning: The LuaTeX and OTFload Lua code are in the beta testing phase.
Use it with care.


Notices about triks used in this file
-------------------------------------

The part of loading fonts in plain.tex file is skipped because we needn't to
preload the old 7bit fonts. These fonts are unusable in Unicoded TeX-engine
when Czech or Slovak languages are used. On the other hand, the Latin Modern
fonts (in Unicode) are preloded.

So: the \font primitive is re-defined before \input plain.tex.
Some skipped macros from plain.tex are copied here.

You can comment/uncomment or add names of the desired language patterns in
the Hyphenation section of this file. See the hyphen.lan file for more details.

The lua code preloaded in order to set more intelligence to the \font
primitive (OTF loading) isn't stored to the format file, unfortunatelly.
So we need to load this in lua-virTeX again. There is some trick here which
loads this code at the first usage of the \font command (\font primitive is 
redefined and it retuns its original meaning after desired lua code is loaded.

The font feature mode=base is set because we need to store the metrics including 
kerning/ligature tables to the dumped format.


------------------------------------------------
