hi:
am trying to write arabic worlds (as btn->setText("إنهاء")).
i tryed many thing but didn't work, as taking the world as wchar_t,, then using the minibidi, then replacing it to string...
but i guess that there is a missing point which is i didn't determine an arabic font file and ask cegui to take the font from that file...
so my question is:
how i can use an arabic font file (font files from operating system for examples) in my cegui application??
any help please...
right to left languages
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi, and welcome
With regards to string literals in C++ files you need to do two things; first you have to cast to CEGUI::utf8* (so for example, btn->setText((CEGUI::utf8*)"إنهاء"); ), and second and importantly, you must then ensure your source file encoding is specified as UTF8.
With regards to fonts, you can use any ttf font that has a Unicode character page. The ttf font can be loaded directly in code, or more usually is 'wrapped' with an XML font definition file. The example fonts that come with CEGUI and also Ogre in the Media/Gui directory use the XML wrapper approach and are a good place to start looking for examples of our approach to fonts
HTH
CE.
With regards to string literals in C++ files you need to do two things; first you have to cast to CEGUI::utf8* (so for example, btn->setText((CEGUI::utf8*)"إنهاء"); ), and second and importantly, you must then ensure your source file encoding is specified as UTF8.
With regards to fonts, you can use any ttf font that has a Unicode character page. The ttf font can be loaded directly in code, or more usually is 'wrapped' with an XML font definition file. The example fonts that come with CEGUI and also Ogre in the Media/Gui directory use the XML wrapper approach and are a good place to start looking for examples of our approach to fonts
HTH
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
samsamsam wrote:Thanks CrazyEddie...
i should read more about unicoding...
you are trying to help here and there...
so thanks
NP
Unicode is a massive, but quite interesting topic. IMO it's well worth people's time to become more familiar with the basic concepts and encodings (which is basically what I did back in '04).
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
hi again...
am still working on my problem...
i wrote this code:
and i got this running time error error:
and if i removed the (CEGUI::utf8*) in the (CEGUI::utf8*) "إنهاء"
to be quit->setText( "إنهاء");
the program will excute normally but the word إنهاء will be written ÓæãÑ
i really don't know what to do...
but am thinking about using a newer release of CEGUI because am using the CEGUI libs which come with OGRE 1.6.1
so i copied the new libs to my projects but the program also crashed...
so what should i do ???? help please ...
am still working on my problem...
i wrote this code:
Code: Select all
mRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mSystem = new CEGUI::System(mRenderer);
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
mSystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage(CEGUI::System::getSingleton().getDefaultMouseCursor());
if(!CEGUI::FontManager::getSingleton().isFontPresent("DejaVuSans-10"))
{
CEGUI::FontManager::getSingleton().createFont("DejaVuSans-10.font");
}
mSystem->setDefaultFont((CEGUI::utf8*)"DejaVuSans-10");
////
CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "CEGUIDemo/Sheet");
//sheet->setFont("DejaVuSans-10");
CEGUI::Window *quit = win->createWindow("TaharezLook/Button", "CEGUIDemo/QuitButton");
quit->setFont("DejaVuSans-10");
quit->setText((CEGUI::utf8*) "إنهاء");
and i got this running time error error:
Unhandled exception at 0x00822848 in startTest.exe: 0xC0000005:
Access violation reading location 0x0043c000.
and if i removed the (CEGUI::utf8*) in the (CEGUI::utf8*) "إنهاء"
to be quit->setText( "إنهاء");
the program will excute normally but the word إنهاء will be written ÓæãÑ
i really don't know what to do...
but am thinking about using a newer release of CEGUI because am using the CEGUI libs which come with OGRE 1.6.1
so i copied the new libs to my projects but the program also crashed...
so what should i do ???? help please ...
samsamsam wrote:hi again...
am still working on my problem...
i wrote this code:Code: Select all
mRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mSystem = new CEGUI::System(mRenderer);
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
mSystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage(CEGUI::System::getSingleton().getDefaultMouseCursor());
if(!CEGUI::FontManager::getSingleton().isFontPresent("DejaVuSans-10"))
{
CEGUI::FontManager::getSingleton().createFont("DejaVuSans-10.font");
}
mSystem->setDefaultFont((CEGUI::utf8*)"DejaVuSans-10");
////
CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "CEGUIDemo/Sheet");
//sheet->setFont("DejaVuSans-10");
CEGUI::Window *quit = win->createWindow("TaharezLook/Button", "CEGUIDemo/QuitButton");
quit->setFont("DejaVuSans-10");
quit->setText((CEGUI::utf8*) "إنهاء");
and i got this running time error error:Unhandled exception at 0x00822848 in startTest.exe: 0xC0000005:
Access violation reading location 0x0043c000.
and if i removed the (CEGUI::utf8*) in the (CEGUI::utf8*) "إنهاء"
to be quit->setText( "إنهاء");
the program will excute normally but the word إنهاء will be written ÓæãÑ
i really don't know what to do...
but am thinking about using a newer release of CEGUI because am using the CEGUI libs which come with OGRE 1.6.1
so i copied the new libs to my projects but the program also crashed...
so what should i do ???? help please ...
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
For the original issue, using the CEGUI that comes with Ogre, I think perhaps your source file is not saved with UTF8 encoding?
With regards to copying over the newer version CEGUI libs and what have you, you also need to recompile the OgreGUIRenderer module against the newer CEGUI version or it will not work correctly (you probably already did this, but I thought I'd mention it - just in case).
CE.
With regards to copying over the newer version CEGUI libs and what have you, you also need to recompile the OgreGUIRenderer module against the newer CEGUI version or it will not work correctly (you probably already did this, but I thought I'd mention it - just in case).
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
hi:
i got my my word "إنهاء" as i want... i did that:
i want here to ask a question even if i think that i know what to do:
am loading my gui from *.layout files, so what to do for arabic worlds in them?
i am saving them as utf-8 so arabic charectars r right but it needs reversing and testing the positinn of letter (as dobidi does)...
so after i load the layout how i can reach all windows in it (all children)??
i only can reach them by name, and i need now to reach them all, without knowing their names...
so could i??
i am thinking now about using XML parser to edit the *.layout files, and make the dobidi work on them, but i prefer the first choice by getting all children of the main window an updating the text values of them...
thanks...
i got my my word "إنهاء" as i want... i did that:
Code: Select all
System::Text::UTF8Encoding^ utf8 = gcnew System::Text::UTF8Encoding;
BYTE ara_buf[256];
wchar_t wara_buf[] = L"إنهاء";
doBidi(wara_buf,5,1,1);
utf8->GetBytes(wara_buf,5,ara_buf,256);
quit->setText((CEGUI::utf8*) ara_buf);
i want here to ask a question even if i think that i know what to do:
am loading my gui from *.layout files, so what to do for arabic worlds in them?
i am saving them as utf-8 so arabic charectars r right but it needs reversing and testing the positinn of letter (as dobidi does)...
so after i load the layout how i can reach all windows in it (all children)??
i only can reach them by name, and i need now to reach them all, without knowing their names...
so could i??
i am thinking now about using XML parser to edit the *.layout files, and make the dobidi work on them, but i prefer the first choice by getting all children of the main window an updating the text values of them...
thanks...
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
First, a heads-up: Assaf Raman's bi-directional text support has been committed to svn trunk, so future versions of CEGUI will be able to support this natively.
As for your question about how to affect all windows within a hierarchy, what you want is something like this:
You pass in a 'start' window, and a pointer to a function that takes a window pointer, the passed function will then be called for every window within the hierarchy. Obviously this is just a silly example and can be customised as needed.
(I didn't actually test this, btw; but it should work).
HTH
CE.
As for your question about how to affect all windows within a hierarchy, what you want is something like this:
Code: Select all
void doSomethingToWindowHierachy(CEGUI::Window* start, void(*func)(CEGUI::Window*))
{
// do it to the starting window.
func(start);
// recursively iterate over all children (thus doing it to them, too)
const size_t child_count = start->getChildCount();
for (size_t i = 0; i < child_count; ++i)
doSomethingToWindowHierachy(start->getChildAtIdx(i), func);
}
You pass in a 'start' window, and a pointer to a function that takes a window pointer, the passed function will then be called for every window within the hierarchy. Obviously this is just a silly example and can be customised as needed.
(I didn't actually test this, btw; but it should work).
HTH
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 5 guests