Skip to main content

persian or arabic character

13 replies [Last post]
raheman
Offline
Joined: 2008-07-20

Hi Shai
i wrote a program and i use persian character with using UTF-8 and i use System Font,
it work well in Nokia N73 and Nokia 5200 but in Sony Ericsson w700 and Sony Ericsson k300 phones ,it couldn't show character well in all of lwuit Component except in T9 in com.sun.lwuit.TextArea !
my question is:

1) is T9 (in Lwuit ) javax.microedition.lcdui .TextBox ? and is a way to getting T9Text?

2) how can i manually create bitmap font that show persian or arabic Character ?

thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
raheman
Offline
Joined: 2008-07-20

Hi
>Is a plain MIDP application capable of drawing persian/arabic text
>(using canvas) on this device. I would assume this is an issue with
>the localization of the device which was probably implemented
>incorrectly.

I use Canvas (in lwuit) but it not work well but Canvas in javax.microedition.lcdui can do this (Simply i had changed tableitem,and now i use it!)

Do javax.microedition.lcdui components use the SE native component ?

Thanks

Shai Almog

Hi,
> I use Canvas (in lwuit) but it not work well but Canvas in
> javax.microedition.lcdui can do this (Simply i had changed
> tableitem,and now i use it!)

I didn't understand this, using something like this worked for you?:

class Test extends javax.microedition.lcdui.Canvas {
public void paint(javax.microedition.lcdui. Graphics g) {
g.setColor(0xffffff);
g.fillRect(0, 0, getWidth(), getHeigh());
g.setColor(0);
g.drawString("Persian Text", 0, 0,
javax.microedition.lcdui.Graphics.TOP |
javax.microedition.lcdui.Graphics.LEFT);
}
}

If this works then LWUIT MUST work!!!

> Do javax.microedition.lcdui components uses the SE native component ?

Yes. The lcdui items in SE are supposed to be the phones native
components.
Thanks.

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

raheman
Offline
Joined: 2008-07-20

Hi

>I didn't understand this, using something like this worked for you ?
>class Test extends javax.microedition.lcdui.Canvas {
>public void paint(javax.microedition.lcdui. Graphics g) {
>g.setColor(0xffffff);
>g.fillRect(0, 0, getWidth(), getHeigh());
>g.setColor(0);
>g.drawString("Persian Text", 0, 0,
>javax.microedition.lcdui.Graphics.TOP |
j>avax.microedition.lcdui.Graphics.LEFT);
>}
>}
>If this works then LWUIT MUST work!!!

yes ,this works on all phones but if i use LWUIT Components (for example it's Canvas) instead of it,it doesn't work on W700 or K300,but works on N73 and 5200
i haven't tested on other phones!
is it a bug on LWUIT Component?

Thanks.

Shai Almog

Hi Raheman,
> yes ,this works on all phones but if i use LWUIT Components (for
> example it's Canvas) instead of it,it doesn't work on W700 or
> K300,but works on N73 and 5200
> i haven't tested on other phones!
> is it a bug on LWUIT Component?

I have no idea this should work, you did replace the text "Persian
Text" with actual text in persian right?

Try this:
class Test extends javax.microedition.lcdui.game.GameCanvas {
public void show(javax.microedition.lcdui.Display d) {
d.setCurrent(this);
d.callSerially(new Runnable() {
public void run() {
javax.microedition.lcdui.Graphics g = getGraphics();
g.setColor(0xffffff);
g.fillRect(0, 0, getWidth(), getHeigh());
g.setColor(0);
g.drawString("Persian Text", 10, 10,
javax.microedition.lcdui.Graphics.TOP |
javax.microedition.lcdui.Graphics.LEFT);
flushGraphics();
}
});
}
}

If that works then try this (after a Display.init(MIDlet) call
obviously):
class Test extends com.sun.lwuit.Form {
public void paint(com.sun.lwuit.Graphics g) {
g.setColor(0xffffff);
g.fillRect(0, 0, getWidth(), getHeigh());
g.setColor(0);
g.drawString("Persian Text", 10, 10);
}
}

Thanks.

>
> Thanks.
> [Message sent by forum member 'raheman' (raheman)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289573
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

raheman
Offline
Joined: 2008-07-20

Hi again
i do something like this:
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;

public class Test
extends GameCanvas {

public Test(){
super(false);
}

public void show(Display d) {
d.setCurrent(this);
d.callSerially(new Runnable() {

public void run() {
Graphics g = getGraphics();
g.setColor(0xffffff);
g.fillRect(0, 0,
getWidth(),
getHeight());
g.setColor(Display.COLOR_FOREGROUND);
g.drawString("سلام", 10, 10,
Graphics.TOP |
Graphics.LEFT);
flushGraphics();
}
});
}
}

but it not worked on W700 like LWUIT!
if you imagine that String "Test" is Persian Word ,
it was displayed something like this:"tseT"

maybe some phone like n73 don't call flushGraphics() for each character and do it for whole String but W700 calls flushGraphics() for each character.
Is a way for controlling Thread?

Thanks.

Message was edited by: armin

abumami
Offline
Joined: 2007-11-19

> but it not worked on W700 like LWUIT!
> if you imagine that String "Test" is Persian Word ,
> it was displayed something like this:"tseT"

Hi raheman,

From my experience, all(?) Sony-Ericsson devices have problems with right-to-left languages in the canvas. I have a program (not written with LWUIT) that the Hebrew displays correctly in forms, but in the canvas it comes out backwards - just like what happens to you. This seems to be a problem with Sony-Ericsson devices and there doesn't seem to be a fix for this.

raheman
Offline
Joined: 2008-07-20

Hi abumami
i think you're right and i tested again Canvas and GameCanas on Sony-Ericsson phones ,so it doen't work well.

But,I added some Commands like this
addCommand(new javax.microedition.lcdui.Command("Persian Word", Command.EXIT, 0));
,it work well on these phone.
but if i used lwuit Command ,it doesn't work well.

Do Commands (in LWUIT) use Canvas or something like that?
And another my question is,
Is source code of LWUIT available?

Thanks
armin ahmady

chen

Hi,
LWUIT preforms all painting on GameCanvas.

lwuit-users@mobileandembedded.org wrote:
> Hi abumami
> i think you're right and i tested again Canvas and GameCanas on Sony-Ericsson phones ,so it doen't work well.
>
> But,I added some Commands like this
> addCommand(new javax.microedition.lcdui.Command("Persian Word", Command.EXIT, 0));
> ,it work well on these phone.
> but if i used lwuit Command ,it doesn't work well.
>
> Do Commands (in LWUIT) use Canvas or something like that?
> And another mt question is,
> Is source code of LWUIT available?
>
Not yet.

Regards,
Chen

> Thanks
> armin ahmady
> [Message sent by forum member 'raheman' (raheman)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289633
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

raheman
Offline
Joined: 2008-07-20

hi chen

thank you for reply me

i hope this problem be fixed in the next version of LWUIT or fixed by Sony-Ericsson !!

regards,
Armin Ahmady

chen

Hi,
Fixing this issue is not something we can control in LWUIT, so you
should report this to Sony-Ericsson.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> hi chen
>
> thank you to reply me
>
> i hope this problem be fixed in the next version of LWUIT or fixed by Sony-Ericsson !!
>
> regards,
> Armin Ahmady
> [Message sent by forum member 'raheman' (raheman)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289655
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

raheman
Offline
Joined: 2008-07-20

thank you for reply me as soon as i think !

i try it with different font faces but that's not work.
some thing that is amazing is that t9 work correctly but other component in lwuit doesn't work correctly in showing persian character!

is any way to use both javax.microedition.lcdui Components and lwuit Components ,in other sounds are they compatible?
thank you again.

Shai Almog

> i try it with different font faces but that's not work.

Is a plain MIDP application capable of drawing persian/arabic text
(using canvas) on this device. I would assume this is an issue with
the localization of the device which was probably implemented
incorrectly.

> some thing that is amazing is that t9 work correctly but other
> component in lwuit doesn't work correctly in showing persian
> character!

T9 uses the SE native component which is probably localized well. The
VM of the device is probably not localized at all in its drawing
primitives.

> is any way to use both javax.microedition.lcdui Components and
> lwuit Components ,in other sounds are they compatible?
> thank you again.

No, they are completely incompatible and there is no feasible way to
integrate them.

Thanks.

> [Message sent by forum member 'raheman' (raheman)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289469
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Shai Almog

Hi Raheman,
> Hi Shai
> i wrote a program and i use persian character with using UTF-8 and
> i use System Font,
> it work well in Nokia N73 and Nokia 5200 but in Sony Ericsson w700
> and Sony Ericsson k300 phones ,it couldn't show character well in
> all of lwuit Component except in T9 in com.sun.lwuit.TextArea !

Thats very interesting.

> my question is:
>
> 1) is T9 (in Lwuit ) javax.microedition.lcdui .TextBox ? and is a
> way to getting T9Text?

Yes, T9 invokes the lcdui TextBox class and if you will review both
the TextArea component and TextBox you will see several fields that
map directly to the native fields.

> 2) how can i manually create bitmap font that show persian or
> arabic Character ?

That can't be done. Arabic won't work because of bidi and shaping
issues which are really difficult to solve in bitmap fonts, we might
be able to fix bidi (the main concern is avoiding the performance
overhead for bidi) but shaping is probably out of scope...

Generally since system fonts map to the VM's font and drawString
method these should work as they do in MIDP. Its possible that no
Arabic/persian script is mapped to one of the MIDP fonts. Try playing
with all the different font faces and see if one of them works
(system, proportional and monospaced), this might be a device issue
there.

Thanks.
Shai Almog
http://lwuit.blogspot.com/

[att1.html]