Arabic Letter

Hi all,

I want to show arabic letter using CCLabelTTF.
I tried to use ICU library, there are many linker errors.

  1. I download ICU from http://site.icu-project.org/download
  2. I extracted it and add to my xcode project.
  3. Code :

#include "unicode/utypes.h" #include "unicode/uchar.h" #include "unicode/locid.h" #include "unicode/ustring.h" #include "unicode/ucnv.h" #include "unicode/unistr.h" #include "unicode/ushape.h"

In a function,

UChar *dest; std::string test = "إِنَّ الَّذِينَ"; UChar *source; UErrorCode error; u_charsToUChars_50(test.c_str(), source, sizeof(test.c_str())); u_shapeArabic(source, sizeof(source), dest, sizeof(dest), 0, &error); std::cout << dest << "\n";

Please help.

nb: Sorry for my bad english.

IIRC std::string is not supposed to be used with unicode like UTF-16 or UTF-32. I guess you need std::wstring instead.

Alexander Belchenko wrote:

IIRC std::string is not supposed to be used with unicode like UTF-16 or UTF-32. I guess you need std::wstring instead.

Thank you Alexander.

But how to convert std::wstring to char * so i can use to create CCLabelTTF ?

I tried download fribidi but still no luck on how to add the fribidi source code to my projects.

With system font it works,

But when i try to use external font, arabic letters are not shape correctly.

Please help :slight_smile:

I have the same problem , can anybody help us ??

Can anybody help and tell how to create a new topic on this forum. There is no button anywhere!