Change the text size on static ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Change the text size on static ?

Post by arfgh »

How can i set the size on the static text added to the scene ?

IGUIStaticText * text=guienv->addStaticText(L"", rect<int>(100,28,200,38),false,false,0,-1,false);
texto->setText(blah);
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Re: Change the text size on static ?

Post by Rytz »

arfgh wrote:How can i set the size on the static text added to the scene ?

IGUIStaticText * text=guienv->addStaticText(L"", rect<int>(100,28,200,38),false,false,0,-1,false);
texto->setText(blah);
The static text object has nothing to do with what you're asking. You need to change the size of the font. Check the FAQ's and Tutorials or do a forum search for "font size".

Here's a couple threads that I found:
http://irrlicht.sourceforge.net/phpBB2/ ... =font+size
http://irrlicht.sourceforge.net/phpBB2/ ... =font+size
Image
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

But i am not using any font. Just the default one.
I only need to make it ab it big..
CuteAlien
Admin
Posts: 9720
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You can't - it's a bitmap font. You can scale the bitmap itself and load that as font, then you have a bigger font. Or you can search the forums for ways to include truetype fonts, those can be scaled.
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
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

"You can't - it's a bitmap font."

are you talking about the file "fontcourier.bmp" included in the irrlicht ?

"You can scale the bitmap itself and load that as font, then you have a bigger font. Or you can search the forums for ways to include truetype fonts, those can be scaled."


can you show me a simple example to do that ?
CuteAlien
Admin
Posts: 9720
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Truetypefonts are discussed for example here: http://irrlicht.sourceforge.net/phpBB2/ ... sc&start=0

You can create fonts with IGUIEnvironment::getFont. The filename is usually that of a bitmap. To change the font for a single static element you can use IGUIStaticText::setOverrideFont. To change it for certain groups of elements you can use IGUISkin::setFont.

I never created a font myself, but there is a fonttool which can help you doing that.
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
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

ok

but can someone explain where is the irrlicht font it uses ?
i mean this so small on it appears when i use the staticText.
CuteAlien
Admin
Posts: 9720
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

That font is saved as sourcecode (you can do so with Gimp) and included in the library.
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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Just use the font tool, part of the SDK, to make your own bitmap font from a TTF font and load it in yourself.
Image Image Image
lobo-tuerto
Posts: 8
Joined: Sat Apr 12, 2008 4:14 pm

Post by lobo-tuerto »

The font tool compiled succesfully in my system (ubuntu 8.04) but when I execute the program, the title bar reads: "Unable to create fonts, your OS is not supported :-("

Do you know why is that?
Blog: Lobo tuerto
En tierrra de ciegos, el tuerto es rey.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Because Linux is not supported :wink:
asiatin
Posts: 6
Joined: Wed Mar 18, 2009 8:31 am
Location: Waldshut / Germany

Post by asiatin »

I have tested the IrrFonttool , its very good and works fine.

and so simple to use.

thanks
asiatin
Post Reply