Irrlicht i18n (Unicode, FreeType, etc.)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Hi, try this version and let me know if it works:
http://irrlicht.pastebin.com/VjkBLk1X
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Hi,

thanks for the revision.
It almost worked this time, there are only few errors left.
I'm sorry I don't know how to remove there errors.
Here is the new log:
http://dl.free.fr/eAUEawc64
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Okay, try this version now:
http://irrlicht.pastebin.com/juRFFdBW
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

CGUITTFont was updated to fix some issues found when loading msgothic.ttc. The problem is that some fonts like MS Gothic don't include a grayscale version of the font. The class would then try to load the monochrome bitmap like a grayscale bitmap and create a huge mess of things.

The new version will properly query the glyph to determine that pixel format the bitmap is stored in, then use the appropriate loading routine.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

This is woking perfectly now!
Thank you very much, you're awesome.
irrUString.h is Ok, moreover freetype wrapper is fine too.
Thank.

The other freetype wrapper I was using was really buggy and I couldn't use more than 1 font :o

Image
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

That is great to hear! The OP is now updated with the new, working version of irrUString.h. Now that I know why Dev-C++ had the the troubles it did, it shouldn't be a problem anymore.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Really great job :) This is very usefull stuff. Only one issue is rendering method of TT fonts. Each sign require set new texture (draw2DImage method) what cause performance drop.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Nadro wrote:Really great job :) This is very usefull stuff. Only one issue is rendering method of TT fonts. Each sign require set new texture (draw2DImage method) what cause performance drop.
Yes, that is really unfortunate. FreeType returns a separate glyph image for each character. The current implementation will create a new texture for each glyph image, then draw each texture one at a time.

The main issue is how to solve it. I've thought about changing the gui classes to render the font to a texture whenever the text changes, and using that texture as a sort of cache. That would definitely speed things up, but it won't work on devices that don't support RTT, and it would require re-writes of most of the GUI classes.

Another solution is to try to turn each TrueType font into a font bitmap file. When it loads glyphs, it draws it into a large texture. Then it could use sprite batches like the current font implementation. It would be a little complicated to code, though, as there are over a million possible glyphs in unicode, and you would also run into texture size problems. When each glyph is used, they would have to be added after the last glyph you added. This would result in a lookup for each character to identify the texture page it is on (you may need more than one texture because of texture size limits) and the position of the character. Then you would have to figure out the placement of each character in the string and batch draw each page one at a time.

Can you think of any other possible methods to improve the speed? Those are currently the only two I can think of.
tinhtoitrangtay
Posts: 70
Joined: Tue Oct 28, 2008 12:59 pm

Post by tinhtoitrangtay »

This is woking perfectly now! But i can't merge to Irrlicht. I have merge to code Irrlicht it don't work. You can patch for irrlicht support FreeType. Thanks
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

tinhtoitrangtay wrote:This is woking perfectly now! But i can't merge to Irrlicht. I have merge to code Irrlicht it don't work. You can patch for irrlicht support FreeType. Thanks
Are you saying that CFileSystem.patch and CXMLReaderImpl.patch are not merging for you? I made the patches around Irrlicht version 1.7.

All of the files in the OP are designed to be compiled with Irrlicht, except for CGUITTFont. That class is designed to be compiled with your project. It does not have the necessary files to be compiled into Irrlicht. This allows you to use it with a pre-compiled copy of Irrlicht.
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

I've uploaded a new version of irrUString.h. You can download it from the OP.

Changes:
  • Fixed a bug with UTF-8 decoding.
  • Merged some irrString.h improvements.
  • Better custom allocator support.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

just wanted to try it but irrUString.h doesn't compile.

Code: Select all

..\..\Libs\irrlicht-1.7.1\include\irrUString.h||In member function `irr::core::ustring16<TAlloc>& irr::core::ustring16<TAlloc>::replace(irr::uchar32_t, irr::uchar32_t)':|
..\..\Libs\irrlicht-1.7.1\include\irrUString.h|1892|error: expected `;' before "a"|
..\..\Libs\irrlicht-1.7.1\include\irrUString.h|1893|error: `a' was not declared in this scope|
||=== Build finished: 2 errors, 3 warnings ===|
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Sudi wrote:just wanted to try it but irrUString.h doesn't compile.

Code: Select all

..\..\Libs\irrlicht-1.7.1\include\irrUString.h||In member function `irr::core::ustring16<TAlloc>& irr::core::ustring16<TAlloc>::replace(irr::uchar32_t, irr::uchar32_t)':|
..\..\Libs\irrlicht-1.7.1\include\irrUString.h|1892|error: expected `;' before "a"|
..\..\Libs\irrlicht-1.7.1\include\irrUString.h|1893|error: `a' was not declared in this scope|
||=== Build finished: 2 errors, 3 warnings ===|
Which compiler are you using?
In the meantime, try this:
Possibly fixed irrUString.h.
ws206771
Posts: 1
Joined: Mon Mar 30, 2009 6:13 am

Post by ws206771 »

Hi Nalin,

I got the following error when compiling your codes,
CXMLWriterUTF8.cpp(46) : error C2065: "BOM_UTF8": undefined identifier

It should be defined in the irrUString.h , correct?

how can I do it ?

Thank you!
Weixing
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Well now, that is embarrassing. I had changed the name of those constants in irrUString.h and forgot to fix CXMLWriterUTF8. I guess I deserve it for not recompiling Irrlicht in a while. I've uploaded a fixed version.
CXMLWriterUTF8.zip
Post Reply