%
% lkligtbl.mf
%
%% Cyrillic font container with T2 encoding beta-support
%
% This file is future part of lxfonts package
% Version 3.2 // Patchlevel=0
% (c) A. Berdnikov
%
% 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 author is entitled to modify this file
% and to save it under the same name.
%
% Content:
%
% Macro definitions for lig & kern data
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LHver_check(3,2);  % like |version_check| in ec

if known loaded_lgligtbl: endinput; fi
loaded_lgligtbl:=1; % if known this file has been loaded

%if unknown loaded_lgerrors:
%   index:=0; input lgerrors; % error messages;
%fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                               %%
%%  Procedures which may be used to make the ligtable data       %%
%%  independent from the particular font coding scheme           %%
%%                                                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

numeric dummy_kern_char; dummy_kern_char:=0;

boolean debug_ligdata;  debug_ligdata:=false;

def beginligtable =
   boolean flag_gener, flag_sp;
   flag_gener:=false; flag_sp:=false;
   def table_data = enddef;
enddef;

vardef labelchar (text chars) =
   forsuffixes $=chars:
      if (str $) <> "": if known $:
         if flag_sp:
            expandafter def expandafter table_data expandafter =
               table_data , $ :
            enddef;
         else:
            expandafter def expandafter table_data expandafter =
               table_data   $ :
            enddef;
         fi
         flag_gener:=true; flag_sp:=false;
      fi fi
   endfor;
enddef;

vardef setkern @# (text chars)=
   if flag_gener:
      forsuffixes $=chars:
         if (str $) <> "": if known $:
            if flag_sp:
               expandafter def expandafter table_data expandafter =
                  table_data , $ kern @#
               enddef;
            else:
               expandafter def expandafter table_data expandafter =
                  table_data   $ kern @#
               enddef;
            fi
            flag_sp:=true;
         fi fi
      endfor;
   fi;
enddef;

vardef setlig(suffix charA, charB) =
   if flag_gener:
      if (known charA) and (known charB):
          if flag_sp:
              expandafter def expandafter table_data expandafter =
                  table_data , charA =: charB
              enddef;
          else:
              expandafter def expandafter table_data expandafter =
                  table_data   charA =: charB
              enddef;
          fi;
          flag_sp:=true;
      fi;
   fi;
enddef;

vardef endligtable=
   if debug_ligdata: showtoken table_data; fi
   if flag_gener:
      if not flag_sp:
         message ("Something is wrong in ligtable:");
         showtoken table_data;
         errmessage ("Dummy kerning with char "
                   & (decimal dummy_kern_char) & " is inserted");
         setkern [0] (0);
         %errmessage_J;
         setkern [dummy_kern_char] (0);
      fi;
      ligtable table_data;
   fi;
   def table_data = enddef;
enddef;

vardef liggroup @# (text chars)=
   def @# = enddef;
   forsuffixes $=chars:
      if (str $) <> "": if known $:
            expandafter def expandafter @# expandafter =
               @# , $
            enddef;
      fi fi
   endfor;
   if debug_ligdata: showtoken @#; fi
enddef;

endinput;
% end-of-file
