% This tries all characters on TEST.MF using three different sets of parameters
% (appropriate for italic styles)
if unknown cmbase: input cmbase fi % omit if CMMF can be assumed
mag=.5;
mode_setup; let mode_setup=\;

boolean running;
def abort = hide(scrollmode; running:=false) enddef;
def pause=stop "done with char "&decimal charcode&". " enddef;
let iff=always_iff;
def ligtable text t=enddef;
def charlist text t=enddef;
def extensible text t=enddef;

string currenttitle;
let semi=;; let echar=endchar; let endchar=enddef;
def cmchar expr s = currenttitle:=s;
 let;=testchar semi quote def chartext=enddef;
def testchar = semi let;=semi;
 % now `chartext echar' will generate the character to be tested
 running:=true; errorstopmode;
 for k=1 upto 6:
  if running: if known params[k]: scantokens params[k]; font_setup;
    currentwindow:=k;
    currenttitle & ", " & fontname[k];
    chartext echar; fi fi endfor
 pause; enddef;

string params[],fontname[];
params[1]="ital_params"; fontname[1]="cmti10";
params[2]="bold_ital_params"; fontname[2]="cmbxti10";
params[3]="tt_params"; fontname[3]="cmmi10";

w_rows=floor 1/2 screen_rows; w_cols=floor 1/3 screen_cols;
def open(expr k,i,j)=
 openwindow k from ((i-1)*w_rows,(j-1)*w_cols) to (i*w_rows,j*w_cols)
 at (-10,140) enddef;
def openit =
 open(1,1,1); open(2,1,2); open(3,1,3);
 open(4,2,1); open(5,2,2); open(6,2,3); enddef;

begingroup delimiters begintext generate;
 def makedef(expr s)(text t) =
  expandafter def scantokens s = t enddef; flushtext enddef;
 def flushtext suffix t = enddef;
 for k=1 upto 6: if known params[k]:
 makedef(params[k])
  expandafter expandafter expandafter begintext
  scantokens ("input "&fontname[k]); fi endfor
endgroup;

input test
end
