home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / BGICHR.ZIP / CHR-TEST.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-03-29  |  2.8 KB  |  88 lines

  1. {$R+,S+,I+,D+,T-,F-,V+,B-,N-,L+ }
  2. { M 16384,0,16384 }
  3.  
  4. { >>> CHECK STATMENTS FLAGGED WITH !PATH! BEFORE RUNNING! <<< }
  5.  
  6. uses
  7.   crt;
  8.  
  9. const
  10.   copyright : array[1..66] of char =
  11.     'Copyright 1988 by Sam Denton, St. Louis, MO, CompuServ 76314,1512.';
  12.   dashes = '-----------------------------------------------------------';
  13.  
  14. var
  15.   i        : integer;
  16.   c        : char;
  17.   font     : file;
  18.   stuff    : record
  19.     offset : word;
  20.     name   : array[1..4] of char;
  21.     size   : word;
  22.     junk   : array[1..4] of byte;
  23.   end;
  24.   buffer, WidthTable, PlotCmds : record
  25.     case integer of
  26.       1: (ptr     : pointer);
  27.       2: (ofs,seg : word);
  28.   end;
  29.   first16  : record
  30.     filler1    : byte;
  31.     NbrChars    : word;
  32.     filler2    : byte;
  33.     LowerBound : byte;
  34.     OffsetP    : word;
  35.     filler3    : byte;
  36.     MaxY       : shortint;
  37.     filler4    : byte;
  38.     MinY       : shortint;
  39.     filler5    : array[1..5] of byte;
  40.   end;
  41.  
  42. begin
  43.  
  44.   WriteLn(dashes);
  45.   for i := 1 to 4 do
  46.     begin
  47.       case i of
  48.         1: Assign(font,'c:\turbo\pascal\litt.chr');                   {!PATH!}
  49.         2: Assign(font,'c:\turbo\pascal\goth.chr');                   {!PATH!}
  50.         3: Assign(font,'c:\turbo\pascal\sans.chr');                   {!PATH!}
  51.         4: Assign(font,'c:\turbo\pascal\trip.chr');                   {!PATH!}
  52.       end;
  53.       Reset(font,1);
  54.       repeat
  55.         BlockRead(font,c,1);
  56.         Write(c);
  57.       until c = ^Z;
  58.       WriteLn;
  59.       BlockRead(font,stuff,sizeof(stuff));
  60.       WriteLn('Important part of file is ',stuff.size,' bytes long.');
  61.       Seek(font,stuff.offset);
  62.       GetMem(buffer.ptr,stuff.size);
  63.       BlockRead(font,buffer.ptr^,stuff.size);
  64.       move(buffer.ptr^,first16,16);
  65.       with first16 do
  66.         begin
  67.           WriteLn('NbrChars=',NbrChars,' LowerBound=',LowerBound,
  68.                   ' OffsetP=',OffsetP,' MaxY=',MaxY,' MinY=',MinY);
  69.           WriteLn('TextHeight(''A'')=',MaxY-MinY);
  70.           WidthTable.ptr := ptr(buffer.seg,buffer.ofs + 2*NbrChars + 16);
  71.           WriteLn('TextWidth(''A'')=',
  72.               byte(ptr(WidthTable.seg,WidthTable.ofs + ord('A') - LowerBound)^));
  73.           PlotCmds.ptr := ptr(buffer.seg,buffer.ofs + 16 + 2*(ord('A') - LowerBound));
  74.           PlotCmds.ptr := ptr(buffer.seg,buffer.ofs + OffsetP + word(PlotCmds.ptr^));
  75.           WriteLn('Plot commands for ''A'', (1:x,0:y)=MoveTo, (1:x 1:y)=LineTo');
  76.           repeat
  77.             Write('(',byte(PlotCmds.ptr^) shr 7,':',byte(PlotCmds.ptr^) and $7F);
  78.             inc(PlotCmds.ofs);
  79.             Write(',',byte(PlotCmds.ptr^) shr 7,':',byte(PlotCmds.ptr^) and $7F);
  80.             inc(PlotCmds.ofs);
  81.             WriteLn(')');
  82.           until word(PlotCmds.ptr^) = 0;
  83.         end;
  84.       close(font);
  85.       WriteLn(dashes);
  86.       delay(2500);
  87.     end;
  88. end.