Page 1 of 1
ANSI alternate font..
Posted: Thu Nov 30, 2006 7:03 am
by spix
Hi,
I have an application I am porting to my OS that uses the ansi code \e[11m to switch to an alternate font and then \e[10m to switch back.
The application expects that this character (which is 'q' in the ordinary font - ie 0x71) in this alternate font is a horizontal line (similar to the lines in the IBM extended characters)
How do I enable and disable this font? I am using the text mode where i put characters at 0xb8000.
Thanks,
Andrew
Posted: Thu Nov 30, 2006 9:08 am
by Combuster
You might want to read
this and
this (which talk about 512-character fonts)
Since the requested character is also present in the extended set, it may be easier to have convert such characters manually.
Posted: Thu Nov 30, 2006 10:21 pm
by spix
Thanks for the links, they were helpful.
I'm not sure I understand it though,
This is my thinking,
To display a character in an alternate font, i need to outport to the correct register that when bit 3 of the attribute byte is set, it is meant to display font set B which is located at the address pointed according to this table:
Code: Select all
* 000b -- Select font residing at 0000h - 1FFFh
* 001b -- Select font residing at 4000h - 5FFFh
* 010b -- Select font residing at 8000h - 9FFFh
* 011b -- Select font residing at C000h - DFFFh
* 100b -- Select font residing at 2000h - 3FFFh
* 101b -- Select font residing at 6000h - 7FFFh
* 110b -- Select font residing at A000h - BFFFh
Do I need to create a font and load it into those addresses or is there already a font in there?
this is the code i am attempting, it's wrong, but i haven't worked it out yet:
Code: Select all
// to change font
outportw(0x3c4, 0x304);
// to restore font
outportw(0x3c4, 0x300);
it doesn't seem to change anything, just prints bold characters.
Posted: Fri Dec 01, 2006 2:52 am
by Combuster
spix wrote:Do I need to create a font and load it into those addresses or is there already a font in there?
Assume only the first font is there. Some programs might have loaded another font but thats hardware/software dependent.
spix wrote:
this is the code i am attempting, it's wrong, but i haven't worked it out yet:
Code: Select all
// to change font
outportw(0x3c4, 0x304);
// to restore font
outportw(0x3c4, 0x300);
it doesn't seem to change anything, just prints bold characters.
You reversed the byte order: word outputting 0x0304 will send value 0x03 to register 4 instead of value 4 to register 3