How to Define Your Own Font in Graphics Mode for EGA or VGA
ID: Q37343
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
-
Microsoft QuickBASIC for MS-DOS, versions 4.0, 4.0b, 4.5
-
Microsoft BASIC Compiler for MS-DOS and MS OS/2, versions 6.0, 6.0b
SUMMARY
A programmer can create a specialized graphics font for use with the
EGA or VGA graphics systems. This new font can then be installed by
making a ROM BIOS interrupt call. When you install this new font,
none of the original graphics characters are available until they are
reinstated.
Note that the Professional Edition of Microsoft Visual Basic for
MS-DOS provides a "Font Toolbox" for using graphical fonts that is
fully documented and handles the low level details (such as setting up
the font in video memory) for you.
MORE INFORMATION
The code example listed below creates and installs a new user font.
This font consists of the following four characters:
triangle
capital Sigma
the fraction 1/3 (one third)
a space
This sample program displays the characters and then reinstates the
original font and displays the original characters.
' To run this program in the environment, you must invoke the
' environment with the /L switch to load the default Quick library:
' VBDOS.EXE /L for Visual Basic 1.0 for MS-DOS
'
' To try this example in VBDOS.EXE:
' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.
' Use the following include file for Visual Basic 1.0 for MS-DOS:
' $INCLUDE: 'VBDOS.BI'
' Use the following include file for QuickBasic for MS-DOS:
' $INCLUDE: 'q:qb.bi'
DIM RegS AS regtype, RegL AS Regtypex
DIM table(100)
DATA 0,0,0,2,6,14,30,62,126,254,0,0,0,0
DATA 0,0,0,254,64,32,16,32,64,254,0,0,0,0
DATA 0,0,0,132,,136,158,162,70,130,14,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0
CLS
DEF SEG = VARSEG(table(0))
FOR i = 1 TO 56
READ A% ' Place the created characters into the new
POKE VARPTR(table(0)) + i, A% ' graphics table.
NEXT i
DEF SEG
SCREEN 9
' Set user defined font.
RegL.AX = &H1121
RegL.BX = &H0
RegL.CX = &HE
RegL.DX = 0
RegL.DS = -1
RegL.ES = VARSEG(table(0))
RegL.BP = VARPTR(table(0))
CALL InterruptX(&H10, RegL, RegL)
LOCATE 10, 10
FOR i = 0 TO 3
PRINT CHR$(i) + CHR$(4); ' Prints new user font.
NEXT
' Switch back.
RegL.AX = &H1122
RegL.BX = 0
CALL InterruptX(&H10, RegL, RegL)
LOCATE 12, 10
FOR i = 0 TO 3
PRINT CHR$(i); " "; ' Prints normal characters.
NEXT
Additional query words:
VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.5 6.00 6.00b
Keywords :
Version : MS-DOS:1.0,4.0,4.0b,4.5; :6.0,6.0b
Platform : MS-DOS
Issue type :