% ---------------------------------------------------------------------------
%%% input use_driver
% This is an auxiliary file which prepares reading a CC parameter file using
% a sneaky-tricky method. Every PC parameter file (such as PCR10, PLCSC10,
% ..., etc.) inputs this file, optionally changes some parameters, and
% then calls the macro |use_driver|.
% ---------------------------------------------------------------------------
% AUTHORS: {\bif{}Bogus\l{}aw Jackowski \& Marek Ry\'cko}
% ---------------------------------------------------------------------------
% This file 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.
% 
% For details see MeXINFO.ENG.
% ---------------------------------------------------------------------------
% HISTORY:
%  7 Jul 1992: version 1.0
% 18 Dec 1992: version 1.01
%    possibility of arbitrary rescaling added: the value of |basic_unit#| can
%    be used to override default |pt#| basic unit (suggestion of M. \L{}akomy);
%    cf. the sample file DCR10.MF producing a |10dd#| roman font
% ---------------------------------------------------------------------------
if unknown cmbase: input cmbase fi;

string driver_name,ss; numeric ii;

vardef generate @# = driver_name:=str @#; endgroup enddef;

vardef use_driver @# =
% |@#| either is empty or is equal to the pt-size of a respective
% CM parametric file
 if unknown param_base:
% in sophisticated applications a user may wish to specify
% |param_base| prior to calling |use_driver|:
  string param_base; param_base=jobname;
 fi
 ii:=0;
 forever:
  ii:=ii+1;
  ss:=substring(length(param_base)-ii,length(param_base)-ii+1) of param_base;
  exitif (ss<"0") or (ss>"9");
 endfor;
 ii:=ii-1;
 if unknown basic_unit#: basic_unit#=pt#; fi % i.e., |basic_unit#:=1|
 numeric scale;
 if str@# <> "":
  scale=basic_unit#*scantokens(
   substring(length(param_base)-ii,length(param_base)) of param_base)/@#;
  ss:="input cc"&(substring(2,length(param_base)-ii) of param_base)&str @#;
 else:
  scale:=basic_unit#;
  ss:="input cc"&(substring(2,length(param_base)) of param_base);
 fi

% |ogonek_pen#| is the only sharp extra PL parameter;
% it must be rescaled separately:
 if known ogonek_pen#: ogonek_pen#:=scale*ogonek_pen#; fi
% input the original driver, possibly rescaling:
 numeric true_pt#; true_pt#=pt#;
 pt#:=scale*true_pt#; scantokens(ss); pt#:=true_pt#;

 if (basic_unit#<>pt#):
  message "Actual font size is " & decimal(designsize) & "pt#";
  message "";
 fi

 font_identifier:=substring(0,length(param_base)-ii) of param_base;
 scantokens("input "&
 if driver_name="roman": "polan"
  elseif driver_name="textit": "polkur"
  elseif driver_name="mathsy": "polmat"
  elseif driver_name="title": "poltyt"
  elseif driver_name="csc": "polkap"
  else: driver_name fi);

enddef;

endinput;
%%\end
