REM $DYNAMIC
DECLARE SUB OutSymbol(OutColumn%,OutRow%,Symbol$)
OPTION BASE 1
DIM SHARED Font%(16384)
DIM Code%
DIM Column%
DIM Row%
DIM Index%
DIM FontName$
PRINT
PRINT "Font viewer."
PRINT "(C) Copyright Sandul Yura Valentinovich."
PRINT "(R) Sunday, 30 March 2003 year."
PRINT "All rights reserved."
PRINT "*** The FreeWare ***"
PRINT
LINE INPUT "Please enter the font file name (empty to quit)=",FontName$
FontName$=LTRIM$(RTRIM$(UCASE$(FontName$)))
IF FontName$="" THEN END
PRINT "Reading font file. Please waith..."
ON ERROR GOTO CannotOpen
OPEN FontName$ FOR RANDOM AS #1 LEN=1
ON ERROR GOTO 0
FIELD #1,1 AS FontData$
Index%=1
WHILE NOT EOF(1)
 ON ERROR GOTO CannotRead
 GET #1
 ON ERROR GOTO 0
 IF NOT EOF(1) THEN
  Font%(Index%)=ASC(FontData$)
  Index%=Index%+1
 END IF
WEND
CLOSE #1
SCREEN 2,0,0,0
PALETTE 0,15
PALETTE 1,0
CLS
Column%=0
Row%=0
FOR Code%=0 TO 255
 CALL OutSymbol(Column%,Row%,CHR$(Code%))
 Column%=Column%+8
 IF Column%=512 THEN
  Column%=8
  Row%=Row%+8
 END IF
NEXT Code%
WHILE INKEY$<>CHR$(27)
WEND
SCREEN 0,1,0,0
COLOR 7,0
CLS
LOCATE 1,1,1,7,8
END
CannotOpen:
PRINT "Cannot open font file."
END
CannotRead:
CLOSE #1
PRINT "Cannot read from the font file."
END
SUB OutSymbol(OutColumn%,OutRow%,Symbol$)
 DIM WorkColumn%
 DIM WorkRow%
 IF Symbol$="" THEN EXIT SUB
 FOR WorkRow%=0 TO 7
  FOR WorkColumn%=0 TO 7
   IF Font%((ASC(Symbol$)*64)+(WorkRow%*8)+WorkColumn%+1) THEN PRESET (OutColumn%+WorkColumn%,OutRow%+WorkRow%),1
  NEXT WorkColumn%
 NEXT WorkRow%
END SUB