Skip to main content

Arabic text rendering in a TextArea

4 replies [Last post]
ghady_rayess
Offline
Joined: 2009-01-09

Hello,

The Arabic text lines are rendered too short in a Text Area. Please check below image:
http://www.foo-me.net/lwuit/arabic.jpg

The code to reproduce is below:

<br />
Form form = new Form("Title");<br />
        form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));<br />
        TextArea ta = new TextArea();<br />
        //TextArea.setUseStringWidth(true);<br />
        //TextArea.setWidestChar('\u0633');<br />
        ta.setAlignment(TextArea.RIGHT);<br />
        String text = "\u0639\u0631\u0628\u064A ";<br />
        StringBuffer str = new StringBuffer();<br />
        for(int x= 0; x < 100; x ++){<br />
            str.append(text);<br />
        }<br />
        ta.setText(str.toString());<br />
        ta.setEditable(false);<br />
        form.addComponent(ta);<br />
        form.show();<br />

when i set TextArea.setUseStringWidth(true); i get out of memory!
i'm using svn 885

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mahdi_hijazi
Offline
Joined: 2010-01-15

you should use TextArea.setUseStringWidth(true) if you are going to use Arabic texts.

which device you got the OutOfMemory Exception on?

ghady_rayess
Offline
Joined: 2009-01-09

I only tried TextArea.setUseStringWidth(true) on the simulator and it always gave me OutOfMemory Exception...

Do you use it in your code? Which SVN do u use?

mahdi_hijazi
Offline
Joined: 2010-01-15

I always use the Latest SVN

vprise
Offline
Joined: 2003-11-07

Without setUseStringWidth(true) this will never work.
Use the version of TextArea that accepts rows/columns and set them to a reasonable value.