Loading Arabic Fonts
Loading Arabic Fonts
Peace Upon you
i dev an Textmode OS without English lang, i want to make this OS in Arbice lang. so i want to know how can i loading new arabic font to memory.
i want to add my fonts by loading its to new plane and switching form english fontt to arabic font by pressing CTR+Shift as instance...
Can any one help me about this idea pleas...
thanx
[edit by candy] don't make your entire message bold faced[/edit]
i dev an Textmode OS without English lang, i want to make this OS in Arbice lang. so i want to know how can i loading new arabic font to memory.
i want to add my fonts by loading its to new plane and switching form english fontt to arabic font by pressing CTR+Shift as instance...
Can any one help me about this idea pleas...
thanx
[edit by candy] don't make your entire message bold faced[/edit]
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Loading Arabic Fonts
1. I hope there are less than 512 characters in arabic alphabet.
2. I hope they all can be distinguished with 9x14 patterns
3. I hope you have such 9x14 data for the characterset.
If all those are matched, i suggest you check freevga documentation to know how you can install a new character set for text mode (basically, that consist of switching to the appropriate bitplane, writing data and switching back).
OT: would you mind sticking to one login name ?
2. I hope they all can be distinguished with 9x14 patterns
3. I hope you have such 9x14 data for the characterset.
If all those are matched, i suggest you check freevga documentation to know how you can install a new character set for text mode (basically, that consist of switching to the appropriate bitplane, writing data and switching back).
OT: would you mind sticking to one login name ?
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Loading Arabic Fonts
afaik, arabic consissts of about 25 letters. Some *might* cross the preferred width. *chuckle*, but then, maybe one could build up kinda 'composite' letters?
One problem althou is, that in arabic, vowels are seldom written as a letter of their own (iirc) but merely expressed in form of one or more dots above or beyond the consonant which follows them, so it might depend on the word how a given letter is written.
One problem althou is, that in arabic, vowels are seldom written as a letter of their own (iirc) but merely expressed in form of one or more dots above or beyond the consonant which follows them, so it might depend on the word how a given letter is written.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Loading Arabic Fonts
In text mode I think you'll have the same problems with Arabic characters as there is with Kanji characters, namely that they require too many curves to be clear in text mode (With monotone and 9x14 pixels good curves are difficult to simulate).
I think the best way forward would be to setup a graphical mode and handle drawing the characters to screen yourself. Text mode is really only useful for a limited number of character sets.
However if you've got a decent text mode character set already then lookup the VGA documentation on loading character sets. If you're still in real mode then BIOS int 0x10 gives a few functions to load character sets, avoiding the need to handle VGA functions manually.
I think the best way forward would be to setup a graphical mode and handle drawing the characters to screen yourself. Text mode is really only useful for a limited number of character sets.
However if you've got a decent text mode character set already then lookup the VGA documentation on loading character sets. If you're still in real mode then BIOS int 0x10 gives a few functions to load character sets, avoiding the need to handle VGA functions manually.
Re:Loading Arabic Fonts
You can reprogram fonts in realmode like this:
Code: Select all
;----------------------------------------------------;
; Resizes text. ;
;----------------------------------------------------;
TextReSize:
pusha
mov ax,1112h ; Set 80x50 mode
? ? ?mov bl,0
?? int 10h
call ReProgamFonts
popa
ret
;----------------------------------------------------;
; Reprogram fonts. ;
;----------------------------------------------------;
ReProgamFonts:
push es
mov ax,ds
mov es,ax
mov bp,DexFont ;<this points to your fonts
mov cx,00FFh
xor dx,dx
mov bx,0800h
mov ax,1100h
int 10h ; ReProgams Fonts
pop es
ret
Re:Loading Arabic Fonts
Thanx Dex4u for your help.....
i had written this code to change the BIOS font...
my problem is't here, my problem of two parts..
the first parts is
1- load my fonts to special table in memory, and keep the original bios font table without changing.
2- switching between my font table and original bios table.
this is the first part of my problem. second part is that i would load this font in protectd mode without using int10.....
thanx all
i had written this code to change the BIOS font...
my problem is't here, my problem of two parts..
the first parts is
1- load my fonts to special table in memory, and keep the original bios font table without changing.
2- switching between my font table and original bios table.
this is the first part of my problem. second part is that i would load this font in protectd mode without using int10.....
thanx all
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Loading Arabic Fonts
well, actually, by programming correctly VGA registers (see "VgaResources" on the FAQ), you can have *two* charactersets, and select which one should be used by the bit 3 of the 'attribute' character (that means you need to toy a bit with colors aswell).
Once you have that set up, selecting between arabic input or latin input will simply toggle a state in your keyboard driver and you'll write the proper attribute to the screen.
I strongly suggest you try to have unicode for all those strings (e.g. 1 byte per character might not be enough for you).
Alternatively, you could decide to put arabic characters in the 'high' part of the ASCII set (e.g. in characters 128-255), instead of e.g. accented characters and table drawing characters (if you have enough room there) so that you can stick to one-byte-per-character.
Once you have that set up, selecting between arabic input or latin input will simply toggle a state in your keyboard driver and you'll write the proper attribute to the screen.
I strongly suggest you try to have unicode for all those strings (e.g. 1 byte per character might not be enough for you).
Alternatively, you could decide to put arabic characters in the 'high' part of the ASCII set (e.g. in characters 128-255), instead of e.g. accented characters and table drawing characters (if you have enough room there) so that you can stick to one-byte-per-character.
Re:Loading Arabic Fonts
Could you put the link of this subject....?(see "VgaResources" on the FAQ )
Re:Loading Arabic Fonts
I would do what Clicker said and re-program unused ASCII, then you only need re-program fonts once in realmode or you could re-program fonts when you press a certain key, you can go to realmode re-program and back to pmode, thats what i do (for vesa mode change etc) and it easy and quick.
Here is a demo,for go to realmode doing a int and back to pmode, with asm source code, you will need vesa2 for it to work.
http://board.flatassembler.net/topic.php?t=3368
Here is a demo,for go to realmode doing a int and back to pmode, with asm source code, you will need vesa2 for it to work.
http://board.flatassembler.net/topic.php?t=3368
Re:Loading Arabic Fonts
I have loaded my font after 128 in ASCII table in memory, but i have a new prblem...
how can i access at this new character when i clickin on the keyboard key...
i want to know how can i print the ascii character after 128 by the the keyboard.
i there another way to loading my font ?
becaus i want to acess a same time to latin and arbic font.
how can i access at this new character when i clickin on the keyboard key...
i want to know how can i print the ascii character after 128 by the the keyboard.
i there another way to loading my font ?
becaus i want to acess a same time to latin and arbic font.
Re:Loading Arabic Fonts
Well if you're still in real mode you can just use BIOS interrupt 0x16 to get a key (In protected mode use the keyboard controller). Then take the scancode/ascii code of the key that was pressed, write some code to translate it to whichever character you want it to represent in arabic, then just dump the appropriate character back on screen.mar-rih wrote: how can i access at this new character when i clickin on the keyboard key...
i want to know how can i print the ascii character after 128 by the the keyboard.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Loading Arabic Fonts
usually, you will get the scancode right from the keyboard port (0x60) at keyboard interrupt (IRQ1). Each key on your keyboard has its own number (the scancode) which you have to interprete with your own mapping table:
E.g. here, my key #16 is 'A' character. Let's say for the purpose of the example there is an arabic symbol '?' on it that you want displayed if "arabic mode is turned on" ...
note: i guess ? is _not_ arabic char, but i can't compose arabic chars with this keyboard and the board doesn't support them anyway, so let's just pretend it is.
When hitting the key, the IRQ1 is fired and reading the kb port gives "16". Your IRQ handler will then look some of its internal variables (like SHIFT&ALT status) to know how it should decode that.
shifted_map[16] would for instance hold ascii char #64 ('A'),
regular_map[16] would hold ascii char #96 ('a')
and arabic_map[16] would hold ascii char #134 which would be the code for your arabic character '?'
E.g. here, my key #16 is 'A' character. Let's say for the purpose of the example there is an arabic symbol '?' on it that you want displayed if "arabic mode is turned on" ...
note: i guess ? is _not_ arabic char, but i can't compose arabic chars with this keyboard and the board doesn't support them anyway, so let's just pretend it is.
When hitting the key, the IRQ1 is fired and reading the kb port gives "16". Your IRQ handler will then look some of its internal variables (like SHIFT&ALT status) to know how it should decode that.
Code: Select all
/*** pseudocode for multilinguist keyboard input
* assuming there's no 'uppercase' in arabic and that
* shift lock can be used to toggle mode.
*/
interrupt keyboard() {
static boolean arabic=false;
static boolean shifted=false;
byte scancode=Keyboard.getByte();
switch(scancode) {
case SHIFT_PRESSED:
shifted=true;
arabic=false;
break;
case SHIFT_RELEASED:
shifted=false;
break;
case SHIFTLOCK_PRESSED:
arabic^=arabic;
Keyboard.UpdateLeds(arabic);
break;
default:
if (arabic) PushCharacter(arabic_map[scancode]);
else if(shifted) PushCharacter(shifted_map[scancode]);
else PushCharacter(latin_map[scancode]);
break;
}
}
regular_map[16] would hold ascii char #96 ('a')
and arabic_map[16] would hold ascii char #134 which would be the code for your arabic character '?'
Re:Loading Arabic Fonts
Thanx for all about thier replies..
i have done..
1- Load the Arab Font after 128 in ASCII in Protected Mode
but i want information about Keymap subject...
could any one help me about this subject please (Sites ,books or tutorials)
i have done..
1- Load the Arab Font after 128 in ASCII in Protected Mode
but i want information about Keymap subject...
could any one help me about this subject please (Sites ,books or tutorials)
Re:Loading Arabic Fonts
Another possibility, albeit more complex, is to use VESA to switch to a higher resolution, and ignore ASCII altogether.
When I was playing around with the VESA framebuffer, I used a version of GRUB with the VBE patch, so it takes care of switching video modes and whatnot. I implemented a console driver on top of that... It's in English, and therefore designed for left-to-right text, but it should be fairly easy to change the glyphs and make it print the text right-to-left. I can try to dig it up if that would help.
When I was playing around with the VESA framebuffer, I used a version of GRUB with the VBE patch, so it takes care of switching video modes and whatnot. I implemented a console driver on top of that... It's in English, and therefore designed for left-to-right text, but it should be fairly easy to change the glyphs and make it print the text right-to-left. I can try to dig it up if that would help.