%
% beresta.tex
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.1 // Patchlevel=0
% (c) O.Lapko
%
% This package belongs to the public domain 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 to save it under the same name.
%
% Content:
%
% Start file; runs documentation files
% with list of all T2 letters created in LHFONTS package in:
% English; Russian languages;
% Russian: Alternative alt; T2 encoding (=Windows 1251) win; KOI-8 koi
%                      ~~~                              ~~~        ~~~
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% necessary fonts:
%
% CM fonts
% ========
% RX fonts: (11ex-rx.tex with \fontfile{beresec})
% ===============================================
% rxrm  (0700) 1000 (1200) 1440
% rxti         1000        1440
% rxss         1000        1440
% rxcsc        1000        1440
% rxtt         1000        1440
%
% additional fonts:
%
% \mainencodingtrue: for documentation in Russian T2 (like Windows1251 encoding)
%
% (11ex-rx.tex with \fontfile{beresec}---see above)
% rxst  1000
% rxsl  1000
%
% \mainencodingfalse: for documentation in Russian Alternative & KOI-8 encodings
%
% LHfonts: (01cm-lh.tex) Alternative
% lhr     7 10 12
% lhsltt    10
% lhsl      10
% lhti      10
% lhbx      10
%
% KCfonts: (24cm-kc.tex) KOI-8
% kcr     7 10 12
% kcsltt    10
% kcsl      10
% kcti      10
% kcbx      10
%
% \poortypefalse: for documentation with addditional non-T2 fonts
%
% (for run these fonts start 90berest.tex and 91berest.tex)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% rwrm 1000
% rwti 1000
%
% txrm 1000 1440
% txti 1000 1440
% txss      1440
% txtt      1440
% txcc      1440
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newif\ifrussiandoc	% documentation in Russian
\newif\ifmainencoding	% documentation in T2 encoding?
\newif\ifalt		% documentation in Alternative (or Koi-8) encoding?
\newif\ifpoortype	% only font with T2 encoding used?

\newlinechar`\^^J
\def\help{
    \message{
     \string\eng = English^^J
     \string\main = T2 encoding (like Windows1251)^^J
     \string\alt = Alternative^^J
     \string\koi = Koi-8^^J
   }%
\message{@Name of language/encoding or type \string\help\ = ^^J}
  \read-1 to\startdoc
}

\def\eng {\russiandocfalse}
\def\main{\russiandoctrue\mainencodingtrue}
\def\alt {\russiandoctrue\mainencodingfalse\alttrue}
\def\koi {\russiandoctrue\mainencodingfalse\altfalse}

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

\message{^^JName of language/encoding or type \string\help\ = ^^J}%
\read-1 to\startdoc
\startdoc
\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

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

\catcode`\_=11

\input rxalt.cod

\ifpoortype
   \def\lowtoup{.2ex}
\else %
   \input txrm1000.cod
   \input txti1000.cod
   \input txcc1000.cod
\fi

% 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
%
\font\dc		rxrm1000
\font\dcit		rxti1000
%
\font\dcr		rxrm1440
\font\dcti		rxti1440
\font\dcss		rxss1440
\font\dctt		rxtt1440
\font\dccsc		rxcc1440

\let\xrm\rm
\let\xti\it
\let\xsl\sl
\let\xbf\bf

% fonts for documentation
\ifrussiandoc		% Russian doc

   \ifmainencoding	% documentation in T2 encoding

      \let\rm\dc
      \font\sevenrm	rxrm0700
      \font\twelverm	rxrm1200
      \let\it\dcit
      \font\sl		rxsl1000
      \font\bf		rxbx1000

   \else		% documentation in alternative encoding

      \ifalt

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

      \else

         \font\rm 	kcr10
         \font\sevenrm	kcr7
         \font\twelverm	kcr12
         \font\it	kcti10
         \font\sl	kcsl10
         \font\bf	kcbx10

      \fi

   \fi

\fi

\rm

% additional fonts

\ifpoortype % \relax

\else

   \font\dcvar		rwrm1000 % fonts
   \font\dcitvar	rwti1000 % with ogoneks
   %
   \font\dctwo		txrm1000
   \font\dcittwo	txti1000
   %
   \font\dcrtwo 	txrm1440
   \font\dctitwo	txti1440
   \font\dcsstwo	txss1440
   \font\dctttwo	txtt1440
   \font\dccsctwo	txcc1440

\fi

% DEFINITIONS

\def\ifpoor#1#2{\ifpoortype{\dc #1 }\else{#2}\fi}

\def\: #1 #2 #3 // #4 //{%
       \vtop{\raggedright\rightskip0ptplus200pt\tt\hsize9em
	  \strut CYR_#1:\hfil\break\strut #3\par}%
       & \vtop{\offinterlineskip\dcr\hsize7pc
	    \hbox{\hbox to1.5pc{\csname CYR_#1\endcsname\hss}\nobreak
	    	  \unskip\hbox to1.5pc{\dccsc\csname CYR_#1\endcsname\hss}\nobreak
	    	  \unskip\hbox to1.5pc{\dcti \csname CYR_#1\endcsname\hss}\nobreak
	    	  \unskip\hbox to1.5pc{\dcss \csname CYR_#1\endcsname\hss}\nobreak
	    	  \unskip\hbox to1pc  {\dctt \csname CYR_#1\endcsname\hss}%
		 }\par}%
         & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize4cm\xrm#4\strut\par}%
	   & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize7.75cm\xrm#2\strut\par}%
    \cr
    \noalign{\vskip.5ex}
}

\def\; #1 #2 #3 // #4 //{%
       \vtop{\raggedright\rightskip0ptplus200pt\tt\hsize9em
	     \strut CYR_#1:\hfil\break\strut #3\par}%
       & \vtop{\offinterlineskip\dcr\hsize7pc
	       \hbox {\hbox to1.5pc{\ifpoor{--}
				{\dcrtwo  \csname    CYR_#1\endcsname}\hss}\nobreak
	              \unskip\hbox to1.5pc{\ifpoor{--}%
				{\dccsctwo\csname  CYRSC_#1\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1.5pc{\ifpoor{--}%
				{\dctitwo \csname   CYRI_#1\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1.5pc{\ifpoor{--}%
				{\dcsstwo \csname    CYR_#1\endcsname}\hss}\nobreak
	    	      \unskip\hbox to1pc  {\ifpoor{--}%
				{\dctttwo \csname    CYR_#1\endcsname}\hss}\ignorespaces
		     }\par}%
         & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize4cm\xsl#4\strut\par}%
	   & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize7.75cm\xsl#2\strut\par}%
       \cr
       \noalign{\vskip.5ex}
}
%

\def\tableonemacros{%
%
    \long\def\> ##1+##2 ##3/##4 ##5 //##6//{%
       \vtop{\raggedright\rightskip0ptplus200pt\tt\hsize9em
	     \strut CYR_##1,\hfil\break\strut CYR_##2:\hfil\break
	     \strut ##3/##4\par}%
       & \vtop{\offinterlineskip\dcr\hsize7pc
	       \hbox{\hbox to1.5pc{\csname CYR_##1\endcsname\hfil}\nobreak
	             \unskip\hbox to1.5pc
				{\dccsc\csname CYR_##1\endcsname\hss}\nobreak
		     \unskip\hbox to1.5pc
				{\dcti \csname CYR_##1\endcsname\hss}\nobreak
		     \unskip\hbox to1.5pc
				{\dcss \csname CYR_##1\endcsname\hss}\nobreak
		     \unskip\hbox to1pc
				{\dctt \csname CYR_##1\endcsname\hss}\ignorespaces
                    }\par
	       \lineskip3pt\lineskiplimit3pt
	       \hbox{\hbox to1.5pc{\csname CYR_##2\endcsname\hfil}\nobreak
		     \unskip\hbox to1.5pc
				{\dccsc\csname CYR_##2\endcsname\hss}\nobreak
		     \unskip\hbox to1.5pc
				{\dcti \csname CYR_##2\endcsname\hss}\nobreak
		     \unskip\hbox to1.5pc
				{\dcss \csname CYR_##2\endcsname\hss}\nobreak
		     \unskip\hbox to1pc
				{\dctt \csname CYR_##2\endcsname\hss}\ignorespaces
	       }\par
         }%
         & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize4cm\xrm##5\strut\par
	   }%
	   & \vtop{\raggedright
		\rightskip0ptplus200pt\hsize7.75cm\rm##6\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\Excl ##1 {{\dc  \csname CYR_##1\endcsname}\ }%
%
   \def\Excls##1 {{\dc  \csname CYR_##1\endcsname}\
	         ({\dcit\csname CYR_##1\endcsname})\ }%
%
%
   \ifpoortype
   %\relax
   \else
%
      \def\Point ##1 {{\dctwo  \csname  CYR_##1\endcsname}\ }%
%
      \def\Points##1 {{\dctwo  \csname  CYR_##1\endcsname}\
	             ({\dcittwo\csname CYRI_##1\endcsname})\ }%
%
   \fi
%
}
\catcode`\@12
%%%

\def\CYR_ {}
\def\CYRI_{}

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

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

\def\){\unskip)}


% "language" macros:

\ifrussiandoc

   \ifmainencoding

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

      \def\accended{\hfil\break{\it ��������������� �����\/}:\hfil\break}

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

      \input berwin.doc

   \else

      \ifalt

         \def\Var{{\it ��ਠ��\/}: }

         \def\accended{\hfil\break{\it ��業�஢���� �㪢�\/}:\hfil\break}

         \def\modified{\hfil\break{\it �㪢� � ����䨪��ࠬ�\/}:\hfil\break}

         \input beralt.doc

      \else

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

         \def\accended{\hfil\break{\it ��������������� �����\/}:\hfil\break}

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

         \input berkoi.doc

      \fi

   \fi

\else

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

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

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

   \input bereng.doc

\fi

\bye
