how to creat Arabic font?

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
alhootti2014
Posts: 12
Joined: Tue Oct 14, 2014 11:47 am

how to creat Arabic font?

Post by alhootti2014 » Mon Oct 20, 2014 10:04 pm

Hi guys
I want to creat arabic font to display on DMD
Please guide me how to do that?
Im using Arduino

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: how to creat Arabic font?

Post by angusgr » Tue Oct 21, 2014 11:15 pm

Hi alhootti,

Unfortunately there's no very easy way to do this. However it should be possible to create a font that includes the ISO 8859-6 or Windows-1256 codepages, which would allow you to display Arabic text.

If you look at this thread:
viewtopic.php?f=26&t=6062

Then there's a link to the font creator tool you can use, and I also talk about the Latin-1 support (same concept, just different codepage) that was contributed by another user. If you use the GLCDFontCreator tool, similar to him, to create an Arabic codepage font then it should work the same.

The other thing missing from the DMD library, unfortunately, is support for right-to-left text display.

Angus

alhootti2014
Posts: 12
Joined: Tue Oct 14, 2014 11:47 am

Re: how to creat Arabic font?

Post by alhootti2014 » Sun Oct 26, 2014 12:31 pm

All thing is done Successfully but Arduino does not recognise Arabic ASCII Like أ Or ب

For example if i wrote in Arabic أ no thing will display on DMD

but when i wrote A it will Display أ on DMD

What is the solution for that ?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: how to creat Arabic font?

Post by angusgr » Sun Oct 26, 2014 8:51 pm

Hi alhooti,

How are you entering the "Arabic ASCII" into your sketch? If you just type the characters like ب into your sketch, they're encoded as Unicode UTF-8.

Unfortunately the Arduino can't decode UTF-8 by itself. Instead you need to enter the characters using an extended character codepage (like the ones I linked to in the last post.)

So, for example, if you're using ISO8859-6 then ب is hex value C8 (you can find this in the row & column of the codepage layout talbe on wikipedia).

So to enter that character in a string, you have to type something like

Code: Select all

Serial.println("This is ""\xc8");
The DMD library example dmd_latin_chars has some examples of doing this with the Latin-1 character set.

I know it's a pain, unfortunately the Arduino doesn't really have enough capacity to store the Unicode->ASCII lookup tables that are required to have it happen automatically.


Angus

alhootti2014
Posts: 12
Joined: Tue Oct 14, 2014 11:47 am

Re: how to creat Arabic font?

Post by alhootti2014 » Mon Oct 27, 2014 7:52 pm

First of all i thank you
But the result is :

This is È

No Arabic character is Shown in serial monitor :cry:

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: how to creat Arabic font?

Post by angusgr » Mon Oct 27, 2014 8:38 pm

Oh sorry, I don't know why I wrote Serial.println() in the example! I meant to write using a DMD function like this:

Code: Select all

const char *msg = "This is ""\xc8";
dmd.drawString(  2,  1, msg, strlen(msg), GRAPHICS_NORMAL );
(The reason it doesn't look the same in the serial monitor is that the serial monitor expects Unicode UTF-8 as well, and the UTF-8 characters are different to the ISO8859-6).

alhootti2014
Posts: 12
Joined: Tue Oct 14, 2014 11:47 am

Re: how to creat Arabic font?

Post by alhootti2014 » Mon Oct 27, 2014 8:56 pm

Same as the previous result there is no change

Code: Select all

void loop(void)
{
   dmd.clearScreen( true );
   dmd.selectFont(Arial_Black_16_ISO_8859_1);
   // Français, Österreich, Magyarország
   const char *MSG = "\xc8";
dmd.drawString(  2,  1, MSG, strlen(MSG), GRAPHICS_NORMAL );
   //const char *MSG = "Fran""\xe7""ais, ""\xd6""sterreich, Magyarorsz""\xe1""g";
   dmd.drawMarquee(MSG,strlen(MSG),(32*DISPLAYS_ACROSS)-1,0);
   long start=millis();
   long timer=start;
   while(1){
     if ((timer+100) < millis()) {
       dmd.stepMarquee(-1,0);
       timer=millis();
     }
   }
}



angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: how to creat Arabic font?

Post by angusgr » Mon Oct 27, 2014 9:42 pm

Hi alhooti,

Sorry, I didn't explain properly. Arial_Black_16_ISO_8859_1 only contains characters for the ISO8859-1 code page, which is Latin 1 (ie European language accented characters). Each code page has different characters mapped in the range 128-255. For Arabic characters you need to make a second font, which has the glyphs (symbols) mapped for ISO8859-6.

The link to the font creator tool is in my first post in this thread.

Angus

alhootti2014
Posts: 12
Joined: Tue Oct 14, 2014 11:47 am

Re: how to creat Arabic font?

Post by alhootti2014 » Tue Oct 28, 2014 3:01 am

Thank you soo much
I will create an Arabic font and keep you posted
I appertiate your cooperation.

Post Reply