%
% beresta.tex
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.5 // Patchlevel=0
% (c) O.Lapko
%
% This package is freeware product under conditions similar to
% those of D. E. Knuth specified for the Computer Modern family of fonts.
% In particular, only the authors are entitled to modify this file
% (and all this package as well) and to save it under the same name.
%
% Content:
%
% Start file; runs documentation file berestax.tex
% with list of all T2 letters created in LHFONTS package in:
% English and Russian (cp866) languages
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% necessary fonts:
%
% CM fonts
% ========
% ===============================================
% rxrm  (0700) 1000 (1200) 1440
% rxti         1000        1440
% rxss         1000        1440
% rxcsc        1000        1440
% rxtt         1000        1440
%
% additional fonts:
%
% LHfonts: (01cm-lh.tex) Alternative
% lhr     7 10 12
% lhsltt    10
% lhsl      10
% lhti      10
% lhbx      10
%
% txrm 1000 1440
% txti 1000 1440
% txss      1440
% txtt      1440
% txcc      1440
%
% rsrm 1000 1440
% rsti 1000 1440
% rsss      1440
% rstt      1440
% rscc      1440
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\ifrussiandoc	% documentation in Russian
\newif\ifpoortype	% only font with T2 encoding used?
\newif\ifknowntype	% only font with T2 encoding used?
\knowntypefalse

\def\eng {\russiandocfalse\knowntypetrue}
\def\rus {\russiandoctrue\knowntypetrue}

\def\poor{\poortypetrue}
\def\full{\poortypefalse}

\rus\full
\newlinechar`\^^J
\def\help{
    \message{
     \string\eng  = Type documentation in English^^J
     \string\rus  = Type documentation in Russian^^J
     \string\poor = Use minimum font set (only standard T2* encodings)^^J
     \string\full = Use full font set^^J
   }%
}

\ifknowntype\else
\message{^^JName of language or type \string\help\ = ^^J}%
\read-1 to\startdoc
\startdoc
\fi
\ifknowntype\else
\message{Could you use additional non-T2 fonts^^J
	or you use full font assortment^^J
	(\string\poor/\string\full)?^^J}
\read-1 to\startdoc
\startdoc
\fi

%%%%%%%%%
\overfullrule=0pt
\hsize185mm\hoffset-.5in
\parindent0pt
\raggedbottom\raggedright

\catcode`\_=11
\ifpoortype

   \input yycodes
   \input rxcodes

\else

   \input lacodes
   \input lbcodes
   \input lccodes
   \input ldcodes
   \input txcodes

\fi

\def\lowtoup{.2ex}

% FONTS
% Common fonts:

% for Latin alphabet
\font\xivrm		cmr10    scaled \magstep2
\font\xivcsc		cmcsc10  scaled \magstep2
\font\xivti		cmti10   scaled \magstep2
\font\xivss		cmss10   scaled \magstep2
\font\xivtt		cmtt10   scaled \magstep2
%
\let\xrm\rm
\let\xti\it
\let\xsl\sl
\let\xbf\bf

% fonts for documentation
\ifrussiandoc		% Russian doc

         \font\rm 	lhr10
         \font\sevenrm	lhr7
         \font\twelverm	lhr12
         \font\it	lhti10
         \font\sl	lhsl10
         \font\bf	lhbx10

\fi

\rm

% additional fonts
\ifpoortype

   \font\dcrma		rxrm1000
   \font\dcita		rxti1000
   \let\dcrmb		\dcrma
   \let\dcitb		\dcita
   \let\dcrmc		\dcrma
   \let\dcitc		\dcita
   \let\dcrmd		\dcrma
   \let\dcitd		\dcita
   \let\dcrmx		\dcrma
   \let\dcitx		\dcita
   %%%
   \font\dcxivrma	rxrm1440
   \font\dcxivita	rxti1440
   \font\dcxivssa	rxss1440
   \font\dcxivtta	rxtt1440
   \font\dcxivsca	rxcc1440
   %%%
   \let\dcxivrmb	\dcxivrma
   \let\dcxivitb	\dcxivita
   \let\dcxivssb	\dcxivssa
   \let\dcxivttb	\dcxivtta
   \let\dcxivscb	\dcxivsca
   %%%
   \let\dcxivrmc	\dcxivrma
   \let\dcxivitc	\dcxivita
   \let\dcxivssc	\dcxivssa
   \let\dcxivttc	\dcxivtta
   \let\dcxivscc	\dcxivsca
   %%%
   \let\dcxivrmd	\dcxivrma
   \let\dcxivitd	\dcxivita
   \let\dcxivssd	\dcxivssa
   \let\dcxivttd	\dcxivtta
   \let\dcxivscd	\dcxivsca
   %%%
   \let\dcxivrmx	\dcxivrma
   \let\dcxivitx	\dcxivita
   \let\dcxivssx	\dcxivssa
   \let\dcxivttx	\dcxivtta
   \let\dcxivscx	\dcxivsca

\else

   \font\dcrmx		txrm1000
   \font\dcitx		txti1000
   \font\dcrma		larm1000
   \font\dcita		lati1000
   \font\dcrmb		lbrm1000
   \font\dcitb		lbti1000
   \font\dcrmc		lcrm1000
   \font\dcitc		lcti1000
   \font\dcrmd		ldrm1000
   \font\dcitd		ldti1000
   %%%
   \font\dcxivrma	larm1440
   \font\dcxivita	lati1440
   \font\dcxivssa	lass1440
   \font\dcxivtta	latt1440
   \font\dcxivsca	lacc1440
   %
   \font\dcxivrmb	lbrm1440
   \font\dcxivitb	lbti1440
   \font\dcxivssb	lbss1440
   \font\dcxivttb	lbtt1440
   \font\dcxivscb	lbcc1440
   %
   \font\dcxivrmc	lcrm1440
   \font\dcxivitc	lcti1440
   \font\dcxivssc	lcss1440
   \font\dcxivttc	lctt1440
   \font\dcxivscc	lccc1440
   %
   \font\dcxivrmd	ldrm1440
   \font\dcxivitd	ldti1440
   \font\dcxivssd	ldss1440
   \font\dcxivttd	ldtt1440
   \font\dcxivscd	ldcc1440
   %
   \font\dcxivrmx	txrm1440
   \font\dcxivitx	txti1440
   \font\dcxivssx	txss1440
   \font\dcxivttx	txtt1440
   \font\dcxivscx	txcc1440

\fi

% DEFINITIONS

\def\ifpoor#1#2{\ifpoortype{\dcrma #1 }\else
	\ifx\dcrmx\undefined{--}\else{#2}\fi\fi}


\def\tableonemacros{%
%
\def\;##1 ##2 ##3 ##4 //##5//{%
       \vtop{\raggedright\rightskip0ptplus200pt\tt\hsize9em
	     \strut CYR_##2:\hfil\break\strut ##4\par}%
       & \vtop{\offinterlineskip\dcxivita\hsize7pc
	       \hbox {\hbox to1.5pc{\ifpoor       {\csname dcxivrmx\endcsname\csname xCYR_##2\endcsname}
				{\csname dcxivrm##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
	              \unskip\hbox to1.5pc{\ifpoor{\csname dcxivscx\endcsname\csname xCYR_##2\endcsname}%
				{\csname dcxivsc##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1.5pc{\ifpoor{\csname dcxivitx\endcsname\csname xCYR_##2\endcsname}%
				{\csname dcxivit##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1.5pc{\ifpoor{\csname dcxivssx\endcsname\csname xCYR_##2\endcsname}%
				{\csname dcxivss##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1pc  {\ifpoor{\csname dcxivttx\endcsname\csname xCYR_##2\endcsname}%
				{\csname dcxivtt##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\ignorespaces
		     }\par}%
         & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize4cm\xsl##5\strut\par}%
	   & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize7.75cm\xsl##3\strut\par}%
       \cr
       \noalign{\vskip.5ex}
}
%
    \def\COD##1##2##3##4##5{%
	\def\chk####1####2{\def\tempa{--}\def\tempb{''}\def\tempx{####2}\def\tempy{####1}%
	\ifx\tempx\tempa\ifx\tempy\empty{\rm--}\else|\fi\else
		\ifx\tempx\tempb{####1|}\else{\ifx\tempy\empty\else####1:\fi####2|}\fi\fi}%
	\hbox to\hsize{\chk{}{##1}|\chk{A}{##2}\chk{B}{##3}\chk{C}{##4}\chk{D}{##5}\hss}}
%
\long
\def\<##1 ##2+##3 ##4##5 ##6 //##7//{%
       \vtop{\raggedright\rightskip0ptplus200pt\tt\hsize9em
	     \strut CYR_##2,\hfil\break\strut CYR_##3:\hfil\break
	     \strut ##4##5\par}%
       & \vtop{\offinterlineskip\dcxivita\hsize7pc
	       \hbox{\hbox to1.5pc{\ifpoor       {\csname dcxivrmx\endcsname\csname xCYR_##2\endcsname}
                                  {\csname dcxivrm##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
	             \unskip\hbox to1.5pc{\ifpoor{\csname dcxivscx\endcsname\csname xCYR_##2\endcsname}
				  {\csname dcxivsc##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
		     \unskip\hbox to1.5pc{\ifpoor{\csname dcxivitx\endcsname\csname xCYR_##2\endcsname}
				  {\csname dcxivit##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
		     \unskip\hbox to1.5pc{\ifpoor{\csname dcxivssx\endcsname\csname xCYR_##2\endcsname}
				  {\csname dcxivss##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\nobreak
		     \unskip\hbox to1pc  {\ifpoor{\csname dcxivttx\endcsname\csname xCYR_##2\endcsname}
				  {\csname dcxivtt##1\endcsname\csname ##1CYR_##2\endcsname}\hss}\ignorespaces
                    }\par
	       \lineskip3pt\lineskiplimit3pt
	       \hbox{\hbox to1.5pc{\ifpoor       {\csname dcxivrmx\endcsname\csname xCYR_##3\endcsname}
                                  {\csname dcxivrm##1\endcsname\csname ##1CYR_##3\endcsname}\hss}\nobreak
		     \unskip\hbox to1.5pc{\ifpoor{\csname dcxivscx\endcsname\csname xCYR_##3\endcsname}
				  {\csname dcxivsc##1\endcsname\csname ##1CYR_##3\endcsname}\hss}\nobreak
		     \unskip\hbox to1.5pc{\ifpoor{\csname dcxivitx\endcsname\csname xCYR_##3\endcsname}
				  {\csname dcxivit##1\endcsname\csname ##1CYR_##3\endcsname}\hss}\nobreak
		     \unskip\hbox to1.5pc{\ifpoor{\csname dcxivssx\endcsname\csname xCYR_##3\endcsname}
				  {\csname dcxivss##1\endcsname\csname ##1CYR_##3\endcsname}\hss}\nobreak
		     \unskip\hbox to1pc  {\ifpoor{\csname dcxivttx\endcsname\csname xCYR_##3\endcsname}
				  {\csname dcxivtt##1\endcsname\csname ##1CYR_##3\endcsname}\hss}\ignorespaces
	       }\par
         }%
         & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize4cm\xrm##6\strut\par
	   }%
	   & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize7.75cm\rm##7\strut\par
	     }%
    \cr
    \noalign{\vskip.5ex}
   }%
}

%%%
\catcode`\@=11

\def\tabletwomacros{%
%
    \def\> ##1 ##2 ##3-- {$\bullet$
       & \vtop{\raggedright\rightskip0ptplus200pt\hsize4cm\rm ##1\strut}
         & ##2
	   & \vtop{\hsize=10cm\rm ##3\strut}
      \cr
   }%
%
%% macros for letters
%
      \def\Point ##1 ##2 {\ifpoor{\csname dcrmx\endcsname\csname xCYR_##2\endcsname}{\csname dcrm##1\endcsname\csname CYR_##2\endcsname}\ }%
%
      \def\Points##1 ##2 {\ifpoor{\csname dcrmx\endcsname\csname xCYR_##2\endcsname}{\csname dcrm##1\endcsname\csname CYR_##2\endcsname}\
	                 (\ifpoor{\csname dcitx\endcsname\csname xCYR_##2\endcsname}{\csname dcit##1\endcsname\csname CYR_##2\endcsname})\ }%
%
%
}
\catcode`\@12
%%%

\def\CYR_ {???}

%for \ALPHABET macro etc
\def\CYR_A	{\ifpoortype\xCYR_A     \else\aCYR_A	 \fi}
\def\CYR_a	{\ifpoortype\xCYR_a     \else\aCYR_a	 \fi}
\def\CYR_B	{\ifpoortype\xCYR_B     \else\aCYR_B	 \fi}
\def\CYR_b	{\ifpoortype\xCYR_b     \else\aCYR_b	 \fi}
\def\CYR_V	{\ifpoortype\xCYR_V     \else\aCYR_V	 \fi}
\def\CYR_v	{\ifpoortype\xCYR_v     \else\aCYR_v	 \fi}
\def\CYR_G	{\ifpoortype\xCYR_G     \else\aCYR_G	 \fi}
\def\CYR_g	{\ifpoortype\xCYR_g     \else\aCYR_g	 \fi}
\def\CYR_D	{\ifpoortype\xCYR_D     \else\aCYR_D	 \fi}
\def\CYR_d	{\ifpoortype\xCYR_d     \else\aCYR_d	 \fi}
\def\CYR_E	{\ifpoortype\xCYR_E     \else\aCYR_E	 \fi}
\def\CYR_e	{\ifpoortype\xCYR_e     \else\aCYR_e	 \fi}
\def\CYR_ZH	{\ifpoortype\xCYR_ZH    \else\aCYR_ZH	 \fi}
\def\CYR_zh	{\ifpoortype\xCYR_zh    \else\aCYR_zh	 \fi}
\def\CYR_Z	{\ifpoortype\xCYR_Z     \else\aCYR_Z	 \fi}
\def\CYR_z	{\ifpoortype\xCYR_z     \else\aCYR_z	 \fi}
\def\CYR_I	{\ifpoortype\xCYR_I     \else\aCYR_I	 \fi}
\def\CYR_i	{\ifpoortype\xCYR_i     \else\aCYR_i	 \fi}
\def\CYR_I_shrt {\ifpoortype\xCYR_I_shrt\else\aCYR_I_shrt\fi}
\def\CYR_i_shrt {\ifpoortype\xCYR_i_shrt\else\aCYR_i_shrt\fi}
\def\CYR_K	{\ifpoortype\xCYR_K     \else\aCYR_K	 \fi}
\def\CYR_k	{\ifpoortype\xCYR_k     \else\aCYR_k	 \fi}
\def\CYR_L	{\ifpoortype\xCYR_L     \else\aCYR_L	 \fi}
\def\CYR_l	{\ifpoortype\xCYR_l     \else\aCYR_l	 \fi}
\def\CYR_M	{\ifpoortype\xCYR_M     \else\aCYR_M	 \fi}
\def\CYR_m	{\ifpoortype\xCYR_m     \else\aCYR_m	 \fi}
\def\CYR_N	{\ifpoortype\xCYR_N     \else\aCYR_N	 \fi}
\def\CYR_n	{\ifpoortype\xCYR_n     \else\aCYR_n	 \fi}
\def\CYR_O	{\ifpoortype\xCYR_O     \else\aCYR_O	 \fi}
\def\CYR_o	{\ifpoortype\xCYR_o     \else\aCYR_o	 \fi}
\def\CYR_P	{\ifpoortype\xCYR_P     \else\aCYR_P	 \fi}
\def\CYR_p	{\ifpoortype\xCYR_p     \else\aCYR_p	 \fi}
\def\CYR_R	{\ifpoortype\xCYR_R     \else\aCYR_R	 \fi}
\def\CYR_r	{\ifpoortype\xCYR_r     \else\aCYR_r	 \fi}
\def\CYR_S	{\ifpoortype\xCYR_S     \else\aCYR_S	 \fi}
\def\CYR_s	{\ifpoortype\xCYR_s     \else\aCYR_s	 \fi}
\def\CYR_T	{\ifpoortype\xCYR_T     \else\aCYR_T	 \fi}
\def\CYR_t	{\ifpoortype\xCYR_t     \else\aCYR_t	 \fi}
\def\CYR_U	{\ifpoortype\xCYR_U     \else\aCYR_U	 \fi}
\def\CYR_u	{\ifpoortype\xCYR_u     \else\aCYR_u	 \fi}
\def\CYR_F	{\ifpoortype\xCYR_F     \else\aCYR_F	 \fi}
\def\CYR_f	{\ifpoortype\xCYR_f     \else\aCYR_f	 \fi}
\def\CYR_H	{\ifpoortype\xCYR_H     \else\aCYR_H	 \fi}
\def\CYR_h	{\ifpoortype\xCYR_h     \else\aCYR_h	 \fi}
\def\CYR_C	{\ifpoortype\xCYR_C     \else\aCYR_C	 \fi}
\def\CYR_c	{\ifpoortype\xCYR_c     \else\aCYR_c	 \fi}
\def\CYR_CH	{\ifpoortype\xCYR_CH    \else\aCYR_CH	 \fi}
\def\CYR_ch	{\ifpoortype\xCYR_ch    \else\aCYR_ch	 \fi}
\def\CYR_SH	{\ifpoortype\xCYR_SH    \else\aCYR_SH	 \fi}
\def\CYR_sh	{\ifpoortype\xCYR_sh    \else\aCYR_sh	 \fi}
\def\CYR_SHCH	{\ifpoortype\xCYR_SHCH  \else\aCYR_SHCH	 \fi}
\def\CYR_shch	{\ifpoortype\xCYR_shch  \else\aCYR_shch	 \fi}
\def\CYR_HRDSN	{\ifpoortype\xCYR_HRDSN \else\aCYR_HRDSN \fi}
\def\CYR_hrdsn	{\ifpoortype\xCYR_hrdsn \else\aCYR_hrdsn \fi}
\def\CYR_ERY	{\ifpoortype\xCYR_ERY   \else\aCYR_ERY	 \fi}
\def\CYR_ery	{\ifpoortype\xCYR_ery   \else\aCYR_ery	 \fi}
\def\CYR_SFTSN	{\ifpoortype\xCYR_SFTSN \else\aCYR_SFTSN \fi}
\def\CYR_sftsn	{\ifpoortype\xCYR_sftsn \else\aCYR_sftsn \fi}
\def\CYR_EREV	{\ifpoortype\xCYR_EREV  \else\aCYR_EREV	 \fi}
\def\CYR_erev	{\ifpoortype\xCYR_erev  \else\aCYR_erev	 \fi}
\def\CYR_YU	{\ifpoortype\xCYR_YU    \else\aCYR_YU	 \fi}
\def\CYR_yu	{\ifpoortype\xCYR_yu    \else\aCYR_yu	 \fi}
\def\CYR_YA	{\ifpoortype\xCYR_YA    \else\aCYR_YA	 \fi}
\def\CYR_ya	{\ifpoortype\xCYR_ya    \else\aCYR_ya	 \fi}
\def\CYR_YO	{\ifpoortype\xCYR_YO    \else\aCYR_YO	 \fi}
\def\CYR_yo	{\ifpoortype\xCYR_yo    \else\aCYR_yo	 \fi}

\def\EXTRA#1{\noalign{\medskip\bf #1\hfil\medskip}}

\def\Sign #1{\ifdim\lastskip>0pt\unskip\fi$^{#1}$}

\def\){\unskip)}


% "language" macros:

\ifrussiandoc

   \def\Var{{\it вариант\/}: }

   \def\accented{\hfil\break{\it акцентированные буквы\/}:\hfil\break}

   \def\modified{\hfil\break{\it буквы с модификаторами\/}:\hfil\break}

   \long\def\twolang#1#2{\bgroup#2\egroup\ignorespaces}

\else

   \def\Var{{\it variant\/}: }

   \def\accented{\hfil\break{\it accented letters\/}:\hfil\break}

   \def\modified{\hfil\break{\it modified letters\/}:\hfil\break}

   \long\def\twolang#1#2{\bgroup#1\egroup\ignorespaces}

\fi

   \input berestax

\bye
