 {~ Screen writing with script letters (scaled by + or - key); Czech code ~}

program p; {p.pas - psan¡ p¡smem  Scri - hra‡ka od Jen¡ka pro Matˆje Hollana}

  {by Jan Hollan for his children;
       edited from a Czech source code by Ondrej Cada
       that the author got in a package contaning *.chr
       with accented Czech letters in Kamenicky's code table}

uses crt, graph, G_Scree , dos;

const
   cl=#13#10;
     KONEC=chr(27);
     ZVETSI='+';
     ZMENSI='-';

procedure testgrapherror;
{ zjist¡, do¨lo-li k chybˆ grafick‚ho driveru }
var  i : integer;
begin
  i:=graphresult;
  if i<>grOk then begin
    closegraph;  { je nutn‚ ukon‡it pr ci v grafick‚m m¢du }
    writeln('Error of graphic driver ',grapherrormsg(i));
    halt(0);
  end
end;

{ hlavn¡ program }

var
  pathtodriver : string;
  argument,gd,i,gm,font,size,Y : integer;

label 001;

begin
  FileMode:=0;
  pathtodriver:=GetEnv('BGI');
  argument:=1;
  size:=16;

    IF Paramcount=0 then
     begin
       writeln(
'Psan¡ p¡smem  Scri -- hra‡ka od Jen¡ka pro Matˆje Hollana',cl,
'vznikl  adaptac¡ programu Fonttest -- viz adres © tp\bgi',cl);
       Highvideo;
       writeln(
'P <text v k¢du b©¡ Kamenick˜ch>',cl);
       Lowvideo;
       writeln(cl,
'Text za p©¡kazem P se zobraz¡ psac¡m p¡smem',cl,
' a pomoc¡ prav˜ch kl ves + a - lze mˆnit jeho velikost',cl);

       writeln(
'(Writing with Scri font -- toy from Jen¡k for Matˆj Hollan,',cl,
'adapted from programme Fonttest - see directory tp\bgi',cl,

'P <Text (characters over 127 assumed in Kamenicky code table)>',cl,cl,

'Text behind command P is displayed in "handwriting"',cl,
' and by + and - keys it can be scaled.)',cl,cl,

' Source code available at http://astro.sci.muni.cz/pub/hollan/programmes)'
);
       halt
     end;

    detectgraph(gd,gm);
    initgraph(gd,gm,pathtodriver);
    testgrapherror;
(*  font:=installuserfont({paramstr(argument)} 'scrc');
                 { instalace po‘adovan‚ho fontu }
    font:=installuserfont({paramstr(argument)} 'sanc');
                 { instalace po‘adovan‚ho fontu }
    testgrapherror;
 *) settextstyle(5,0,USERCHARSIZE); { 5 je SCRI - jeho nastaven¡ }
    while true do
     begin
      setusercharsize(size,6,size,6);  { nastaven¡ velikosti textu }
      testgrapherror;
      cleardevice; Y:= 0; MoveTo(size*2,0);
      for i:=argument to paramcount do
       begin  { v¨echny zbyl‚ parametry ... }
        if TextWidth(ParamStr(i)) > getmaxx-GetX then
         begin
          Inc(Y,Round(TextHeight('†')*0.75));
          outtextXY(size,Y,paramstr(i));
          MoveTo(TextWidth(ParamStr(i)),Y)
         end
        else outtext(paramstr(i)); {       ... se vyp¡¨¡ }
        outtext(' ');
       end;
001 :
      case readkey of
       { KONEC : begin
          closegraph;
          testgrapherror;
          exit;
        end;
      }  ZVETSI :
          inc(size);
        ZMENSI :
          if size>1 then dec(size);
        'T','t': PriGScrC;
        else   begin
          closegraph;
          testgrapherror;
          exit;
               end;
         { goto 001; }
      end
     end
{  end}
end.

{ konec souboru fonttest.c }
