KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q37341: How to Create Your Own Font in Character Mode for EGA Text

Article: Q37341
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | B_BasicCom | mspl13_basic
Last Modified: 28-DEC-1989

The code example below shows a method of creating a user-defined text
font for use with an EGA or VGA monitor. This method allows a person
to define a specified number of new characters that are in order
starting at a specified position in the table. Only those characters
in the character set that are overwritten by the new fonts are
changed. In the example below, the three new characters are printed
and the fourth character from the original set is printed.

This code example applies to QuickBASIC Versions 4.00, 4.00b, and
4.50, to Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS,
and to Microsoft BASIC PDS Version 7.00 for MS-DOS.

Note: Microsoft BASIC PDS Version 7.00 comes with a library of
routines that allow loading and displaying of bitmapped fonts. BASIC
PDS 7.00 comes with several font files, and the font library routines
can load and display any of the Microsoft Windows bitmapped fonts.

The following is a code example:

' $INCLUDE: '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

CLS
DEF SEG = VARSEG(table(0))
FOR i = 1 TO 42
   READ A%        'Place the NEW characters into
   POKE VARPTR(table(0)) + i, A%    'graphics table
NEXT i
DEF SEG

RegL.AX = &H1100   ' function 11 subfunction 0
RegL.BX = &HE00    ' There are &HE points per character
                   ' put font at table 0
RegL.CX = &H3      ' defined three characters
RegL.DX = 0        ' first character is chr$ (0)
RegL.DS = -1       ' use old data seg
RegL.ES = VARSEG(table(0))  ' address of table
RegL.BP = VARPTR(table(0))  ' that holds the fonts
CALL interruptX(&H10, RegL, RegL)  ' make the call

PRINT CHR$(0) + CHR$(1) + CHR$(2) + CHR$(3)

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.