Discussion:
Changing screen raster font from VB
(too old to reply)
Jonathan Rothwell
2006-02-25 10:31:41 UTC
Permalink
I've used DOS-like command shells that allow you to change the
text-only-mode raster font. Is it possible to do this within VB/DOS? Or if
not, can you do it in standard DOS mode?

Thanks very much.
--
---------------------------
Jonathan Rothwell
SaturnOS
saturnos.atspace.org
Ethan Winer
2006-02-26 17:50:47 UTC
Permalink
Jonathan,
Post by Jonathan Rothwell
I've used DOS-like command shells that allow you to change the
text-only-mode raster font. Is it possible to do this within VB/DOS? Or if
not, can you do it in standard DOS mode? <

I found some old code from a friend that shows how to load two fonts, so
hopefully you can cull what you need from this.

--Ethan

======================

'More info on Int 10h Fn 11h can be found in "PC Intern" by Michal Tischer
' **********************************
' DUALFONT.BAS
' **********************************

' Dual font demo for VBDOS
' Written by Steve York

' The following program is an example of how to use 2 fonts simultaneously
' on a VGA (or EGA) monitor.
' This example requires that VBDOS.QLB be loaded to run in the IDE or

' linking with VBDOS.LIB to create an executable.
' To run in the IDE, start with: VBDOS DUALFONT /L VBDOS.QLB

DEFINT A-Z
DECLARE SUB UnloadFont ()
DECLARE SUB LoadFont ()

TYPE RegTypeX
AX AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE

CLS
LoadFont ' Load the font into memory.

PALETTE 15, 7 ' Set high intensity foreground to regular white
' so they look the same

COLOR 7, 0 ' regular white on black
PRINT "A"; ' character we programmed
COLOR 15, 0 ' high intensity changes to second font...
PRINT "A"; ' same character.

SLEEP ' wait for a keystroke.
UnloadFont ' Set back to normal
PALETTE ' Reset palette to default
SLEEP

SUB LoadFont
DIM InRegs AS RegTypeX
DIM OutRegs AS RegTypeX
DIM Table AS STRING

' First copy the ROM font as a starting point...
InRegs.AX = &H1104 ' Function 11h, sub function 04h, Load ROM 8x16
InRegs.BX = &H1 ' Font #1
CALL InterruptX(&H10, InRegs, OutRegs)

' Put character data into a string so it can be passed...
Table = "ABCDEFGHIJKLMNOP" 'these are the bytes of character data, and

' in this context create a "random" shape
' Program the character...
InRegs.AX = &H1100 ' Function 11h, sub function 00h, Load User Font
InRegs.BX = &H1001 ' 16 bytes/char, font #1
InRegs.CX = &H1 ' # of characters to program
InRegs.DX = 65 ' ASCII code of 1st char to program ('A')
InRegs.BP = SADD(Table) ' Offset of char data
'InRegs.ES = VARSEG(Table) ' Segment of char data -- use this line for QB
InRegs.ES = SSEG(Table) ' use this line for PDS and VB/DOS
CALL InterruptX(&H10, InRegs, OutRegs)

' Set the secondary font...
InRegs.AX = &H1103 ' Function 11h, sub function 03h, Set Display Fonts
InRegs.BX = &H4 ' Set secondary font to #1
CALL InterruptX(&H10, InRegs, OutRegs)
END SUB

SUB UnloadFont
DIM InRegs AS RegTypeX
DIM OutRegs AS RegTypeX

InRegs.AX = &H1103 ' Function 11h, sub function 03h, set display fonts
InRegs.BX = &H0 ' Back to Font #0
CALL InterruptX(&H10, InRegs, OutRegs)
END SUB
Jonathan Rothwell
2006-03-04 12:27:00 UTC
Permalink
Thanks for your help, Ethan, but I was actually looking to be able to load
.FON files and replace the font on the screen with that. Thanks.
Post by Ethan Winer
Jonathan,
Post by Jonathan Rothwell
I've used DOS-like command shells that allow you to change the
text-only-mode raster font. Is it possible to do this within VB/DOS? Or if
not, can you do it in standard DOS mode? <
I found some old code from a friend that shows how to load two fonts, so
hopefully you can cull what you need from this.
--Ethan
======================
'More info on Int 10h Fn 11h can be found in "PC Intern" by Michal Tischer
' **********************************
' DUALFONT.BAS
' **********************************
' Dual font demo for VBDOS
' Written by Steve York
' The following program is an example of how to use 2 fonts simultaneously
' on a VGA (or EGA) monitor.
' This example requires that VBDOS.QLB be loaded to run in the IDE or
' linking with VBDOS.LIB to create an executable.
' To run in the IDE, start with: VBDOS DUALFONT /L VBDOS.QLB
DEFINT A-Z
DECLARE SUB UnloadFont ()
DECLARE SUB LoadFont ()
TYPE RegTypeX
AX AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE
CLS
LoadFont ' Load the font into memory.
PALETTE 15, 7 ' Set high intensity foreground to regular white
' so they look the same
COLOR 7, 0 ' regular white on black
PRINT "A"; ' character we programmed
COLOR 15, 0 ' high intensity changes to second font...
PRINT "A"; ' same character.
SLEEP ' wait for a keystroke.
UnloadFont ' Set back to normal
PALETTE ' Reset palette to default
SLEEP
SUB LoadFont
DIM InRegs AS RegTypeX
DIM OutRegs AS RegTypeX
DIM Table AS STRING
' First copy the ROM font as a starting point...
InRegs.AX = &H1104 ' Function 11h, sub function 04h, Load ROM 8x16
InRegs.BX = &H1 ' Font #1
CALL InterruptX(&H10, InRegs, OutRegs)
' Put character data into a string so it can be passed...
Table = "ABCDEFGHIJKLMNOP" 'these are the bytes of character data, and
' in this context create a "random" shape
' Program the character...
InRegs.AX = &H1100 ' Function 11h, sub function 00h, Load User Font
InRegs.BX = &H1001 ' 16 bytes/char, font #1
InRegs.CX = &H1 ' # of characters to program
InRegs.DX = 65 ' ASCII code of 1st char to program ('A')
InRegs.BP = SADD(Table) ' Offset of char data
'InRegs.ES = VARSEG(Table) ' Segment of char data -- use this line for QB
InRegs.ES = SSEG(Table) ' use this line for PDS and VB/DOS
CALL InterruptX(&H10, InRegs, OutRegs)
' Set the secondary font...
InRegs.AX = &H1103 ' Function 11h, sub function 03h, Set Display Fonts
InRegs.BX = &H4 ' Set secondary font to #1
CALL InterruptX(&H10, InRegs, OutRegs)
END SUB
SUB UnloadFont
DIM InRegs AS RegTypeX
DIM OutRegs AS RegTypeX
InRegs.AX = &H1103 ' Function 11h, sub function 03h, set display fonts
InRegs.BX = &H0 ' Back to Font #0
CALL InterruptX(&H10, InRegs, OutRegs)
END SUB
Stephen Howe
2006-03-06 14:02:39 UTC
Permalink
Post by Jonathan Rothwell
Thanks for your help, Ethan, but I was actually looking to be able to load
.FON files and replace the font on the screen with that. Thanks.
You can do it. There was a library that came with the professional version
of PDS 7.0/7.1 & VBDOS 1.0 that allows you to load FON files. Mind you I was
disappointed with it as it is a cut-down version of the equivalent library
that comes with VC 1.52c.
The BASIC version only supported Bitmap FON files whereas VC supported that
and Vector FON files.

But I am not sure what you mean by "replace the font on the screen".
In text mode? In graphics mode?

Stephen Howe
Jonathan Rothwell
2006-03-15 17:22:51 UTC
Permalink
Preferably in text mode.
Post by Stephen Howe
Post by Jonathan Rothwell
Thanks for your help, Ethan, but I was actually looking to be able to load
.FON files and replace the font on the screen with that. Thanks.
You can do it. There was a library that came with the professional version
of PDS 7.0/7.1 & VBDOS 1.0 that allows you to load FON files. Mind you I was
disappointed with it as it is a cut-down version of the equivalent library
that comes with VC 1.52c.
The BASIC version only supported Bitmap FON files whereas VC supported that
and Vector FON files.
But I am not sure what you mean by "replace the font on the screen".
In text mode? In graphics mode?
Stephen Howe
Stephen Howe
2006-03-15 19:05:27 UTC
Permalink
Post by Jonathan Rothwell
Preferably in text mode.
That library I mentioned won't do it. It is for graphics mode.
You either need to the work yourself or find a DOS library that has already
done it.
There are a number of issues that need facing:

(i) IIRC, the MDPA & CGA font table cannot be replaced, they are hard-coded
in.
For EGA, it supports bitmap-fonts of 8x8, 14x8 variety
For VGA, it supports bitmap-fonts of 8x8, 14x8, 14x9, 16x8, 16x9 variety
These are used when you change the number of lines on screen to 25, 28 (VGA
only), 43, 50.
I cannot remember what MCGA supported nor the various monitor types if just
Black-and-White

This is from the QBASIC guide:
40 x 25, 40 x 43, 40 x 50, 80 x 25, 80 x 43, or 80 x 50 text format,
8 x 8 character box (8 x 14, 9 x 14, or 9 x 16 with EGA or VGA)
16 colors assigned to any of 16 attributes (with CGA or EGA)
64 colors assigned to any of 16 attributes (with EGA or VGA)
Depending on the text resolution and adapter, 8 video memory pages
So if you were going to use FON files, you want bitmap FON files and only
those that support these exact bitmap vertical/height limits.

(ii) There is the codepage and character set that need thinking about.
Only certain FON files have the original VGA OEM character set (the BIOS
chracter set)
Different countries can map it something else.

All of these are loaded via an interrupt 10h, (ax = 1110h, 1120h, 1130h???)
which if it points to a table of chracters will load that. For VGA 9x16 and
9x14, they load from the same table of 8x14 and 8x16 as 8th column of dots
is duplicated in the 9th column.

(iii) See here
http://www.tug.org/tetex/html/fontfaq/cf_57.html#SEC194
Unfortunately the link does not work. So it is a matter of finding
fntcol14.zip on the Internet

(iv) To me, it seems that want you want to do is do
BASIC SCREEN or WIDTH statement
Followed by some library code that loads a font from a file or array
using interrupt 10h having established the video adapter type.

(v) This newsgroup fragment might be of interest for comp.font
Post by Jonathan Rothwell
Does this group have a newer FAQ than the one I founded from 1996? Just
curious.
No ... it's my understanding that "The Lawyers" have taken care of
insuring that the FAQ
Post by Jonathan Rothwell
will NEVER be updated.
As a substitute ... you can try the abf FAQ at
http://abf.jamesgoffin.co.uk/
It is relatively complete, and relatively up-to-date.
(vi) The last comp.font FAQ mentioned above is at
http://nwalsh.com/comp.fonts/FAQ/

(vii) I think there was a DOS font file format. Extension CGI.
And perhaps Font tools that came with MSDOS 6.22 but I cannot find anything
about it.
When I get home I will check. I have the MSDOS 5.0 manual (and 6.22
somewhere)

Stephen Howe

Loading...