×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    27

    Write Arabic letters with Canvas and Graphics class

    I am trying to write an Arabic string with the Graphics.drawString(String) method but it puts the letters in wrong order and dont put the letters together.

    Are there other ways of writing strings with the low level Graphics API that I can test?

    I have tested one high level method and it worked just fine (Form, stringItem) but I prefer the low level API.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Write Arabic letters with Canvas and Graphics class

    I think support for right-to-left scripts (like Arabic) in the low-level UI on many devices is probably quite poor.

    You could use Graphics.drawChar(), but I suspect you will get all the characters in isolated form.

    You can create your own font, and use that. See Custom fonts: step by step. This is a rough guide to creating and using your own font.

    The advantage to using your own font is that you get control over the appearance, and you get the same appearance on all devices.

    The sample code given is suitable for left-to-right scripts like Latin, Cyrillic or Greek.

    For right-to-left, "x += ..." becomes "x -= ...", and you'd want to use Graphice.RIGHT instead of .LEFT. (Supporting L-R and R-L in the same code is more complicated!!)

    You also need to draw each character in isolated, initial, medial and final forms, and choose the correct form (since all forms of the same letter have the same Unicode value).

    Are you trying this on an emulator or device? If you're using an emulator, it's worth checking if the device is better, before you try to fix a problem that only happens on the emulator...

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    27

    Re: Write Arabic letters with Canvas and Graphics class

    tanks for the answer!

    Actually the emulator writes the words just fine but my device doesn't

    With your right-left example do you mean anchor points?

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Write Arabic letters with Canvas and Graphics class

    I mean the direction of writing. So, "left-to-right" is scripts like Latin or Cyrillic, which are normally anchored at the left. "Right-to-left" is Arabic or Hebrew, normally anchored at the right.

    You might want to search the forum... there are certainly Arabic-speaking users here, and some of them must have seen the same problem.

    Cheers,
    Graham.

Similar Threads

  1. Applying Graphics to Canvas used for Image capture
    By sepanaho in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2010-01-13, 11:30
  2. Nokia E61i is caching Graphics of Canvas !!!
    By arpit2agrawal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2009-01-28, 08:37
  3. Weird Canvas Error...
    By i5009820 in forum Symbian
    Replies: 4
    Last Post: 2008-12-01, 09:17
  4. How to draw graphics on video Canvas
    By yaziaiwugui in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2007-08-23, 08:03
  5. Using the Graphics object outside of paint()?
    By weedy in forum Mobile Java General
    Replies: 4
    Last Post: 2003-06-06, 10:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×