Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SAMPLER.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM sampler;
{ SAMPLER.PAS : Demonstrates using different fonts }
USES
Crt, MSGraph;
CONST
crlf = #13 + #10;
nfonts = 6;
texttypes : ARRAY [1..2, 1..nfonts] OF CSTRING[8] =
(
( 'roman', 'courier', 'helv', 'tms rmn', 'modern', 'script'),
( 'ROMAN', 'COURIER', 'HELV', 'TMS RMN', 'MODERN', 'SCRIPT')
) ;
faces : ARRAY [1..nfonts] OF CSTRING[12] =
( 't''roman''',
't''cour''',
't''helv''',
't''tms rmn''',
't''modern''',
't''script'''
);
fontpath : CSTRING = '*.FON';
VAR
list : CSTRING;
vc : _VideoConfig;
i,a : Integer;
stra : STRING[3];
ch : Char;
BEGIN { Begin main program }
{ Read header information from all .FON files in
the current directory.
}
a := _RegisterFonts( fontpath );
IF (a < 0) THEN
BEGIN
_OutText( 'Error: Cannot register fonts.' );
Halt( 1 );
END;
{ Set the highest available video mode. }
a := _SetVideoMode( _MaxResMode );
{ Copy video configuration into structure vc. }
_GetVideoConfig( vc );
{ Display six lines of sample text. }
FOR i := 1 TO nfonts DO
BEGIN
list := faces[i] + 'bh24w24';
a:= _SetFont( list );
IF (a <> -1) THEN
BEGIN
_SetColor( i + 1 );
_MoveTo( 0, i * 30 );
_OutGText( texttypes[2,i] );
_MoveTo( vc.NumXPixels DIV 2, i * 30 );
_OutGText( texttypes[1,i] + crlf );
END { if a <> -1 }
ELSE
BEGIN
a := _SetVideoMode( _DefaultMode );
_OutText( 'Error: Cannot set font.' );
Halt( 1 );
END; { else clause }
END; { FOR statement }
ch := ReadKey;
a := _SetVideoMode( _DefaultMode );
_UnRegisterFonts; { Returns memory used by fonts }
END.