ANSI alternate font..

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

ANSI alternate font..

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply