How to set the font in an IGUITab or IGUITabControl

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
Aelis440
Posts: 52
Joined: Sun Oct 05, 2008 8:45 pm

How to set the font in an IGUITab or IGUITabControl

Post by Aelis440 »

How is this done? I do not see a way to do so. Thanks.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Is there some reason that you didn't look to the implementation to find your answer? If you had looked, you would have seen the following code...

Code: Select all

  490 void CGUITabControl::draw()
  491 {
  492 	if (!IsVisible)
  493 		return;
  494 
  495 	IGUISkin* skin = Environment->getSkin();
  496 	if (!skin)
  497 		return;
  498 
  499 	IGUIFont* font = skin->getFont();
So it looks like the tab control gets the font from the gui skin. If you looked at the skin interface, you might notice the following method declarations...

Code: Select all

   44 		//! returns the default font
   45 		virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
   46 
   47 		//! sets a default font
   48 		virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
Ideally the tab control would allow you to override the font, like you can for other controls. The changes would be trivial. If you wanted such an enhancement to be added, the quickest way is to write the change yourself and to post a patch here or to the tracker.

Travis
Aelis440
Posts: 52
Joined: Sun Oct 05, 2008 8:45 pm

Post by Aelis440 »

I understand all that, I was just curious if there was some obscure/more abstract way of setting the font that I could not find. Especially since merely setting the skin would apply it to any control without the ability to set an override font (an undesired effect).
vitek wrote:Ideally the tab control would allow you to override the font, like you can for other controls.
This was in fact what I was looking for. I will add the enhancement in my own code, but I am not too familiar with the tracker, so if I can figure it out I will definitely add it.

Thanks.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

My point was that if you look at the code, you can see where the font comes from, and given that you can find if there are any ways to set the font for the control...
Post Reply