OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:11 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 5:38 am 
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]


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 5:54 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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 ?

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 6:08 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 11:59 am
Posts: 1600
Location: Vienna/Austria
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.

_________________
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image


Top
 Profile  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 6:50 am 
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.


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 8:54 am 
You can reprogram fonts in realmode like this:
Code:
;----------------------------------------------------;
; 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


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 22, 2005 6:19 pm 
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


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Sat Apr 23, 2005 7:38 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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.

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Sat Apr 23, 2005 8:41 am 
Quote:
(see "VgaResources" on the FAQ )


Could you put the link of this subject....?


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Sat Apr 23, 2005 9:00 am 
VgaResources

That area of the website has most of the info you'll need on almost anything.


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Sat Apr 23, 2005 12:49 pm 
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


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Mon Apr 25, 2005 8:03 pm 
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.


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Mon Apr 25, 2005 8:36 pm 
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.


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.


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Tue Apr 26, 2005 3:39 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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.


Code:
/*** 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;
    }
}


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

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 29, 2005 9:03 am 
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)


Top
  
 
 Post subject: Re:Loading Arabic Fonts
PostPosted: Fri Apr 29, 2005 4:01 pm 
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.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Amazonbot [bot], Bing [Bot], DotBot [Bot], Majestic-12 [Bot], mrjbom, thewrongchristian and 71 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group