home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
FNTPAK32.ZIP
/
PASCAL.EXE
/
DEMOFNT1.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-08-16
|
7KB
|
202 lines
{*************************************************************************
DemoFnt1.PAS Copyright 1994 Rob W. Smetana
Demonstrate:
1. Using GetMonitor (in Video.OBJ) to see if we're using EGA/VGA
Also use it to set FontSize -- to restore the right default font.
2. How to CALL Font Pak fonts (and use font-related procedures).
3. How to get two fonts on the screen at once -- in text mode!
4. Using Font_Pak.Pas to declare all Font Pak routines -- except
callable OBJ fonts.
NOTE: You MUST declare all Font Pak procedures -- including callable
OBJ fonts -- as FAR calls. You'll crash if you do otherwise!
We'll load 2 fonts plus 1 set of line-draw characters. Then
notice how easy it is to switch back and forth between these
two fonts and the default font.
There are 5 pieces in this demo:
1. Display some text -- in both Low and High intensity colors.
2. Pre-load blocks 1 and 2 so we'll have line-draw chars. in each block.
3. Load 2 fonts into blocks 1 and 2. Also load custom line-draw
characters into 1 block.
4. Demonstrate how to switch fonts (several ways).
5. Restore the default font, select block 0, and exit.
*************************************************************************}
uses CRT, Font_Pak; {use Font_Pak.Pas to declare everything}
{$F+} { IMPORTANT: OBJ fonts (and all our procedures) are FAR calls.}
{ You MUST declare these F+ -- or your programs may crash. }
{ declare the CALLable fonts we'll use }
procedure Hollow9 (Block: integer); external;
{$L Hollow9.OBJ}
procedure Script1 (Block: integer); external;
{$L SCRIPT1.OBJ}
procedure Frazzle (Block: integer); external;
{$L FRAZZL16.OBJ}
{$F-}
Var
Ch:Char;
HollowBlock, ScriptBlock, Block, FontSize, WhichMonitor: Integer;
Procedure Is_it_EGA_or_VGA;
{************************************ Demonstrate GetMonitor }
{ Bail out if not EGA or VGA }
Begin
TextAttr := 23; ClrScr;
fpInitialize; ClrScr; { useful for shareware versions only }
Write (' GetMonitor reports you have ');
WhichMonitor := GetMonitor;
{ bail out if there's no EGA or VGA }
case WhichMonitor of
0, 4, 5: { 0=No monitor, 4 = CGA, 5 = Monochrome }
Begin
ClrScr;
WriteLn(' This demo requires an EGA or VGA monitor. Sorry, I have to end.');
halt;
end;
3: Begin
Write ('an EGA');
FontSize := 14; {restore the 8x14 default font}
end;
7,8: Begin
Write ('a VGA');
FontSize := 16; {restore the 8x16 default font}
end;
end; {case}
Write (' monitor. OK to proceed. Press <SPACE>.');
Ch := ReadKey;
End;
Procedure DisplayText;
Begin
{ Put some text on screen }
Writeln(' ┌─░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓ FONT DEMO ▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░─┐ ');
Writeln(' ░│ We''ll display this once. Then, as we call different fonts, the appear- │ ');
Writeln(' ░│ ance changes. Note that we''re using partial fonts to re-map just some │ ');
Writeln(' ░│ characters. This lets us load different subsets of fonts, then change │ ');
Writeln(' ░│ them whenever we want (without disturbing other subsets). │ ');
Writeln(' ░│ ╒═══════╕ ╔══╦═══╗ ╓───╖ │ ');
Writeln(' ░│ ┌──────┼─────┐ ╔══════╦═══════╗ ╒═════╧═════╕ │ ║ ─╫───╫────╜ ║ │ ');
Writeln(' ░│ └──────┼─────┘ ╚═══════════╬══╝ ║ ╘═════╪═════╛ ║ ╙───╫────────╜ │ ');
Writeln(' ░│ │ ╚════╝ ╘═════════ ╙──────╜ │ ');
Writeln(' ░└──────────────────────────────────────────────────────────────────────────┘ ');
Writeln(' ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ');
Writeln('');
end;
begin
Is_it_EGA_or_VGA; {end if there's no EGA/VGA}
DarkBlue; {use a dark blue background}
ClrScr;
{ Put some text on screen }
TextColor (11); {1st in a bright foreground color}
DisplayText;
TextBackground (7);
TextColor (0); {then in a normal foreground color}
DisplayText;
TextAttr := 112; {to print messages}
{
Pre-load blocks 1 and 2. This ensures we have line-draw characters
in these blocks since the fonts we're loading are "partial" fonts
with only keyboard characters in them. Try commenting out the next
few lines to see what happens if we don't pre-load these blocks.
Note: you must comment out the pre-load code BEFORE you run this.
Otherwise, the 1st time you run this, it'll load blocks 1 & 2.
}
Block := 1;
rsLoadDefault (FontSize, Block);
Block := 2;
rsLoadDefault (FontSize, Block);
{ Load 2 fonts into blocks 1 and 2, leaving the default Block 0 intact. }
HollowBlock := 1;
Hollow9 (HollowBlock);
{ replace the line-draw characters in 1 block -- only }
Frazzle (HollowBlock);
ScriptBlock := 2;
Script1(ScriptBlock);
GotoXY(20,25); Write('The default font. Press <SPACE>.');
Ch:= ReadKey;
{ Now CHANGE the DISPLAY by selecting 1 or 2 fonts -- by selecting BLOCKS. }
GotoXY(20,25); Write('Script and Hollow');
rsWhichFonts (HollowBlock, ScriptBlock); Ch := ReadKey;
GotoXY(20,25); Write('Hollow and Script');
rsWhichFonts (ScriptBlock, HollowBlock); Ch := ReadKey;
GotoXY(20,25); Write('Script exclusively ');
rsWhichFonts (ScriptBlock, ScriptBlock); Ch := ReadKey;
GotoXY(20,25); Write('Hollow exclusively ');
rsWhichFonts (HollowBlock, HollowBlock); Ch := ReadKey;
GotoXY(20,25); Write('The Default and Script');
HollowBlock := 0; rsWhichFonts (ScriptBlock, HollowBlock);
{ Pause, then reset font to block 0 exclusively. }
Ch := ReadKey;
DefaultPalette (0); {restore default background colors}
GotoXY(20,25); Write('Back to the default ');
{
Load the default font into block 0. This should NOT be necessary
because our demo didn't change block 0. But if YOU edited this
and re-mapped block 0, this step ensures we end "clean."
}
Block := 0;
rsLoadDefault (FontSize, Block);
rsWhichFonts (Block, Block); Ch := ReadKey;
end.