msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Changing screen raster font from VB

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS
Author Message
Jonathan Rothwell



Joined: 04 Oct 2007
Posts: 7

PostPosted: Sat Feb 25, 2006 3:31 pm    Post subject: Changing screen raster font from VB Reply with quote

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

Archived from group: microsoft>public>vb>dos
Back to top
View user's profile Send private message
Ethan Winer



Joined: 04 Oct 2007
Posts: 30

PostPosted: Sun Feb 26, 2006 5:50 pm    Post subject: Re: Changing screen raster font from VB Reply with quote

Jonathan,

> 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
Back to top
View user's profile Send private message
Jonathan Rothwell



Joined: 04 Oct 2007
Posts: 7

PostPosted: Sat Mar 04, 2006 5:27 pm    Post subject: Re: Changing screen raster font from VB Reply with quote

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.

"Ethan Winer" wrote in message @TK2MSFTNGP15.phx.gbl...
> Jonathan,
>
>> 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
>
>
Back to top
View user's profile Send private message
Stephen Howe



Joined: 04 Oct 2007
Posts: 59

PostPosted: Mon Mar 06, 2006 7:02 pm    Post subject: Re: Changing screen raster font from VB Reply with quote

> 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
Back to top
View user's profile Send private message
Jonathan Rothwell



Joined: 04 Oct 2007
Posts: 7

PostPosted: Wed Mar 15, 2006 10:22 pm    Post subject: Re: Changing screen raster font from VB Reply with quote

Preferably in text mode.

"Stephen Howe" wrote in message @TK2MSFTNGP12.phx.gbl...
>> 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
>
>
Back to top
View user's profile Send private message
Stephen Howe



Joined: 04 Oct 2007
Posts: 59

PostPosted: Thu Mar 16, 2006 12:05 am    Post subject: Re: Changing screen raster font from VB Reply with quote

> 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
>>>>>>>>>>>>>>
>>>>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
>>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

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
... E' possibile cambiare tipo di font con VBDOS ??? Come da oggetto, ... .... sto' realizzando un programmino che mi visualizzi alcuni dati su di un display. Ho dei problemi per fare due cose: - Vorrei cambiare il tipo di Font per metterne uno piu "carino". E' possibile ??? - Questo carattere deve avere un

SCREEN.ControlPanel(DESKTOP_BACKCOLOR) Hi, How would you get vbdos to return the integer of it's background color? I can set it ok like this : = 1 but I can't get it to return it on a etc thanks,

Changing Screen Resolution from within VB How do I chack and change my screen resolution from within VB6 if it is possible? I Thanks Emma

Using my own font in my distributable VB app Hi As I'd like to use a particular font in my VB app, is it possible for me to distribute this with my app and auto-install it using say InnoSetup? Is there any security issues in doing this? Would a user's say XP machine stop this font installation and u

How to get font name list ?? Hello, How can use Win32 API to retrieve all the font name list in VB 6??? Eric -- If you know what you are doing, it is not called RESEARCH!
Post new topic   Reply to topic    msvisual.com Forum Index -> VB DOS All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group