Irrlicht i18n (Unicode, FreeType, etc.)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Jake007 » Wed Jul 06, 2011 6:00 am

I managed to get it working :).
When I tried to run it again ( directly from Code::Blocks CTRL + F10) with new version of CGUITTFont compiled in, it crashed again. It wrote that it couldn't open arial.ttf although I have it in correct folder. Then I tried to run just compiled .exe ( double click) in and it worked.

I feel stupid because I didn't try this earlier. Sorry for the caused trouble and my bad English.

Eariler it crashed on this line, but I guess that it doesn't matter any more ;):
cpp Code: Select all
tt_font->draw( L"Simple font test!", rect<s32>( 0, 0,100, 100), SColor( 0, 50, 50, 50), false, false,0);


Regards,
Jake
Jake007
 
Posts: 16
Joined: Wed Jun 29, 2011 8:39 pm
Location: Slovenia

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Wed Jul 06, 2011 1:38 pm

Jake007 wrote:Eariler it crashed on this line, but I guess that it doesn't matter any more ;)

I think I see what happened. It failed to load the font, so it returned a nullptr. You then tried to use tt_font->draw. Well, tt_font was 0, so you got a null pointer exception.
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Virror » Mon Sep 26, 2011 12:15 pm

The TTF loader was just what i was looking for! Great one : D
Virror
 
Posts: 191
Joined: Mon May 02, 2011 3:15 pm

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Virror » Mon Sep 26, 2011 4:06 pm

Hmm, getting "error C2664: 'irr::video::ITexture::lock' : cannot convert parameter 1 from 'bool' to 'irr::video::E_TEXTURE_LOCK_MODE'"
When compiling the code. Error is on line 923
"void* ptr = tex->lock(true);"
Virror
 
Posts: 191
Joined: Mon May 02, 2011 3:15 pm

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Mon Sep 26, 2011 4:40 pm

Virror wrote:Hmm, getting "error C2664: 'irr::video::ITexture::lock' : cannot convert parameter 1 from 'bool' to 'irr::video::E_TEXTURE_LOCK_MODE'"
When compiling the code. Error is on line 923
"void* ptr = tex->lock(true);"

It looks like you are using the 1.7.2 patch set on the SVN trunk code. That problem is fixed if you use the SVN trunk patches. You can fix it like this:
cpp Code: Select all
void* ptr = tex->lock(video::ETLM_READ_ONLY);
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Virror » Mon Sep 26, 2011 6:09 pm

Works like a charm!
Thanx alot for the help and this super nice project : D
Virror
 
Posts: 191
Joined: Mon May 02, 2011 3:15 pm

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Fri Sep 30, 2011 3:37 pm

New version of irrUString:
  • Fixed a bug with the replace() function.
  • Added new operator+= overloads. char appends characters while short/long, unsigned short/long, and double convert a number into a string. If you are using GCC 4.5 in C++11 mode, int and unsigned int also convert a number into a string, as char32_t takes over their assigned function of adding individual unicode characters.
  • Added new operator+ overloads. char appends characters while short/long/int, unsigned short/long/int, and float/double convert a number into a string. If you are using GCC 4.5 in C++11 mode, char32_t can be used to append unicode characters.
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby randombob » Sun Oct 23, 2011 12:01 am

how do you incorporate this into a project? can someone give me a project with just this, or is there a framework with this and irrbullet allready on it? btw good job looks great :D
randombob
 
Posts: 1
Joined: Sat Oct 22, 2011 10:33 pm

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Sun Oct 23, 2011 4:55 am

randombob wrote:how do you incorporate this into a project? can someone give me a project with just this, or is there a framework with this and irrbullet allready on it? btw good job looks great :D

You can make use of the unicode string class, TrueType fonts, and string tables without modifying Irrlicht.

For the unicode string class, you just have to #include "irrUString.h" in your headers (you can put it into irrlicht.h to make it easier on you.)

For TrueType fonts and string tables, just add the sources directly to your project and use them.

If you need the ability to read/write unicode XML files, you will have to modify the Irrlicht source and build it yourself. You won't be able to use the pre-compiled library.
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby sagetarian » Sun Oct 30, 2011 8:37 am

Just wanted to thank you for this. Works like charm :D
sagetarian
 
Posts: 1
Joined: Sat Oct 29, 2011 10:18 am

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Felyza » Mon Jan 09, 2012 8:21 am

Visual Studio Express 2008, irrLicht 1.7.2

Added irrUString.h to project, got this...
cpp Code: Select all
 
1>path\irrUString.h(3849) : error C2039: 'unary_function' : is not a member of 'std'
1>path\irrUString.h(3849) : error C2504: 'unary_function' : base class undefined
1>path\irrUString.h(3849) : error C2143: syntax error : missing ',' before '<'
 


Fixed it with this...
cpp Code: Select all
 
#ifndef USTRING_NO_STL
#   include <string>
#   include <iterator>
#   include <ostream>
#   include <functional> // Add this line
#endif
 

Don't know if this is the ideal solution (didn't look for a better define to throw it under), but it works for my instance.

With these errors fixed, CGUITTFont.cpp built fine and works a charm, thanks.

Sure wish someone who's more skilled than I would get around to adding TTF functionality into irrlicht (hint hint)....
Felyza
 
Posts: 9
Joined: Sun Aug 09, 2009 4:30 am

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Mon Jan 09, 2012 8:17 pm

Thanks for catching that. You put it in the right place, so don't worry about that. I've uploaded the fixed version.

For anyone who still watches this thread, I have a newer version of irrUString.h in the pipeline. It replaces occurrences of u32 and s32 with size_t to make it more portable. The only problem is that it isn't a trivial change, so I am going to have to (finally) create a test suite and test it. And I am sure I also saw some potential issues with iterators in some of the algorithms...
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Felyza » Tue Jan 10, 2012 3:18 pm

Ok, so I decided to check out the svn. After fixing a problem with the project file where someone forgot to add files to all projects, I found out CGUITTFont doesn't build anymore.

So, here's what to change to make this work with current svn (r4032)!

cpp Code: Select all
 
  video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch)
  {
        using namespace video; //add this line, might as well here since its only needed in this scope
 


cpp Code: Select all
 
        // Acquire a read-only lock of the corresponding page texture.
        void* ptr = tex->lock(ETLM_READ_ONLY); //true gets changed to ETLM_READ_ONLY (needs video namespace)
 


cpp Code: Select all
 
                                IMesh* meshcopy = mani->createMeshCopy(shared_plane_ptr_);
                                mani->scale(meshcopy, vector3df((f32)letter_size.Width, (f32)letter_size.Height, 1)); //this line is changed to scale from scaleMesh
 


With these changes, and the previous one I posted yesterday, all is well and working in latest svn.
Felyza
 
Posts: 9
Joined: Sun Aug 09, 2009 4:30 am

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby Nalin » Tue Jan 10, 2012 7:33 pm

Felyza wrote:Ok, so I decided to check out the svn. After fixing a problem with the project file where someone forgot to add files to all projects, I found out CGUITTFont doesn't build anymore.

So, here's what to change to make this work with current svn (r4032)!

Thanks, but I caught that a while ago. I have two different patch sets in the OP: svn trunk and 1.7.2. The trunk patches contain these fixes already. If you happen to find anything else, let me know. That reminds me, though, that I haven't checked out the latest Irrlicht trunk head in a while now. I'll upload a newer trunk patch that will apply cleanly to the latest head revision.
Nalin
 
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA

Re: Irrlicht i18n (Unicode, FreeType, etc.)

Postby christianclavet » Sun May 20, 2012 6:47 pm

Hi, Nalin.

Been trying lately to use your ustring class. Don't know if I'm using it properly:

- Since I don't want to patch Irrlicht in any way, I included the file from my own project
cpp Code: Select all
#include <irrlicht.h>
#include "irrUString.h"


I load a string from a irrXML node (My file is UTF8) and want it converted to wchar so I can use and display it properly in Irrlicht:
cpp Code: Select all
core::stringw  result = L"";
core::ustring result2 = L"";
 
result2=(core::ustring)description; // change the data type to ustring (Is this ok?), "description is the raw text in stringw"
result = (result2.toWCHAR()); // Try to get the proper conversion to WCHAR (got error C2679)
list->addItem(result.c_str()); // Add the result in a listbox to see if the text is converted properly.


Edit: Reading from of this thread, I think I will have to patch the XML loader, as the data came from there.
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest