TrueType font Support by FreeType Library

A forum to store posts deemed exceptionally wise and useful
CuteAlien
Admin
Posts: 9728
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, i think those are new in irrlicht1.3. The problem is that they are pure virtual for now. I'm not sure if they are needed for the truetypefonts so you might try just adding those functions in CGUITTFont.h. Just do nothing in the set functions and return 0 in the get functions.
psyberion
Posts: 2
Joined: Mon Apr 09, 2007 12:16 am

Post by psyberion »

Thanks, I gave that a go and it compiled/linked ok, but on running I get the command window and then an alert:

The procedure entry point _ZN3irr12createDeviceENS_5video13E_DRIVER_TYPEERKNS_4core11dimension2dIiEEjbbbPNS_14IEventReceiverEPKc could not be located in the dynamic link library Irrlicht.dll

I don't know if this is anything to do with the freetype library I built, but all the Irrlicht examples have compiled and executed just fine.
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

If anyone is still reading this... I tried to add this to my project. I am seeing the following 2 things

If i build my own release build of the lib, I get a lot of these linker errors(I am using vstudios.net 7.1)

MSVCRT.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCR71.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)

If i use the lib from the root directory of the zip it compiles but i get a ton of warnings that look like this:

LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library
freetype219ST.lib(autohint.obj) : warning LNK4099: PDB 'vc60.pdb' was not found with 'C:\Program Files\irrlicht\irrtruetype\freetype219ST.lib' or at 'd:\dev2\c\Zombies\Debug\vc60.pdb'; linking object as if no debug info
freetype219ST.lib(bdf.obj) : warning LNK4099: PDB 'vc60.pdb' was not found with 'C:\Program Files\irrlicht\irrtruetype\freetype219ST.lib' or at 'd:\dev2\c\Zombies\Debug\vc60.pdb'; linking object as if no debug info


I haven't done a lib without a dll before. I just added the lib to my directories list, and I assume i put the lib in the program folder at runtime. However these linker errors.. im not sure what to do with.
Whats the proper way to use this with visual studios?
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

This was evidently caused by me using a multithreaded build of this instead of single threaded...
Gota love c++ ;)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

This is not a C++ issue, but part of the M$ DLL hell.
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Do you know if this is dead? His website has a link to a zip with just the font class, but not all the other stuff. The link he provides is to an older version then some people are talking about(2.2.1? I find no link to that). Using 2.1.9(the one he provides)I get huge memory dumps when I quit if I dont do a drop on the font. If i do a drop it craps out on irrallocator.h which appears to be trying to destruct the glyph array inside his font class. Another odd thing is the destructor of the font does a drop on the driver, and since it didn't create the driver I thought it shouldn't be doing that.

I'm looking for a good font solution other then making tons of my own bitmaps.
CuteAlien
Admin
Posts: 9728
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I have put an updated version of that code on my website (http://www.michaelzeilfelder.de/irrlicht.htm). It does also fix the memory leaks.

I think it still has the problem mentioned a few post above with the missing virtual functions (I still found not time to care about that). Just implement them as empty functions.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Thats hilarious. I have my own FontManager class and I bet its very similar. Ill try your code and see if my problems go away.

Your class is almost the exact same as mine too :) GET OUT OF MY MIND!!!
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

By the way, if either you have a second, take a look at a question of mine here:
http://irrlicht.sourceforge.net/phpBB2/ ... 840#126840
It hasn't gotten any nibbles yet ;)
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Awsome this works great. Thanks a ton!
a-fung
Posts: 1
Joined: Sat Sep 29, 2007 2:10 pm

Post by a-fung »

Halo,

May I know is there anyway to make this work in C#?
lester
Posts: 86
Joined: Mon Jan 29, 2007 3:33 pm

Post by lester »

Yes, Irrlicht .NET CP has TTFont feature. Look at this topic for details http://irrlichtnetcp.sourceforge.net/ph ... .php?t=582
dearingj
Posts: 7
Joined: Sun Dec 30, 2007 5:43 am
Contact:

license?

Post by dearingj »

Is this code available under a specific software license? I'd like to use it in future projects which may be open source.
CuteAlien
Admin
Posts: 9728
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Freetype has it's own license which is very similar to BSD. So you can use it like you want, but you must mention them somewhere in your documentation or credits.

Can't tell about the code from zgock here, I just hope he meant it to be free. My modifications for it are as free as possible - so wtfpl would fit. (http://sam.zoy.org/wtfpl/)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
malahaas
Posts: 4
Joined: Mon Jan 14, 2008 9:26 pm
Location: Salem, MA

Post by malahaas »

Hi, I started trying to use this patch a couple days ago. I have it incorporated in my game (as in it compiles and I can call the draw function). However, when I set the font ("skin->setFont(font)") it seems to set up correctly then when it reaches the drawAll() for the IGUIEnvironment it briefly prints the below 2 lines and terminates.

Code: Select all

	      5 [main] BladeKing 4468 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
	    403 [main] BladeKing 4468 open_stackdumpfile: Dumping stack trace to BladeKing.exe.stackdump
"BladeKing.exe.stackdump" contains:

Code: Select all

Exception: STATUS_ACCESS_VIOLATION at eip=004170F8
eax=00000000 ebx=0022C6F8 ecx=00000000 edx=103684B8 esi=0022C6F8 edi=00EA6F48
ebp=0022C4F0 esp=0022C4C8 program=C:\dev\eclipse\BladeKing\Debug\BladeKing.exe, pid 5840, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022C4F0  004170F8  (107F0200, 0022C6F8, 00000000, 0022C55C)
0022C510  100BB776  (00EAAD20, 0022C6F8, 770E1B41, 770E1AFF)
0022C540  100F84FF  (053999B0, 0022C6F8, 0022C6C0, 100D9A12)
0022C550  102C6DB3  (05399AB8, 0022C6F8, 00000001, 00000000)
0022C6C0  100D9A12  (05399DC8, 0022C6F8, 00000000, 00F2EA74)
0022C720  1009A07B  (01209948, 0022C8E8, 00000000, 00000000)
0022C750  100BEADE  (00EAAD20, 0022C8E8, 6B688141, 770E1BB8)
0022C770  1010F2DC  (00EA6F48, 0022C8E8, 00000000, 00000000)
0022C920  10112ED0  (000A0744, 00000202, 00000000, 00830097)
0022C94C  770E1A10  (10112B40, 000A0744, 00000202, 00000000)
0022C9C4  770E1AE8  (00000000, 10112B40, 000A0744, 00000202)
0022C9F4  770E2D6E  (FFFF0667, 000A0744, 00000202, 00000000)
0022CA14  770E2D14  (FFFF0667, 000A0744, 00000202, 00000000)
0022CA50  6B68834F  (000A0744, 00000202, 00000000, 00830097)
0022CA7C  770E1A10  (6B688141, 000A0744, 00000202, 00000000)
0022CAF4  770E1AE8  (00000000, 6B688141, 000A0744, 00000202)
End of stack trace (more stack frames may be present)
any thoughts on what I should do? I've tried googling the error and havent found much.

Also, I am not able to use the driver->draw2dImage() method for my font (or at all I think)...I switched to env->addImage() and it works fine, but I was curious why the previous one (the one used by the original CGUITTFONT code) doesnt work for me. Thoughts?

Thanks in advance for any help you can provide.
Post Reply