Page 1 of 1

changing the size of the font

Posted: Fri Jul 13, 2007 18:59
by jchmack
I am trying to change the size of the text displayed in a listbox. I am using the basic taharez scheme. Is there a way i can change the size of this text?

Posted: Fri Jul 13, 2007 20:53
by Rackle
Maybe (yes, that's a big maybe) changing the "Font" property of the ListboxItem, from which is derived ListboxTextItem, is what you're after. Each "font" refers to font name, size, and style.

You'll probably also have to call upon the ListboxItem's handleUpdatedItemData() function to update the listbox item.

Another approach would be to read through Levia's Create a CheckListboxItem tutorial. That way you may have greater control over the attributes you need, such as the font size.

Posted: Fri Jul 13, 2007 20:58
by scriptkid
Hi, assuming that you are using the latest CEGUI version, the taharez.scheme contains a line with the default font being used:

<Font Name="Commonwealth-10" Filename="Commonwealth-10.font" />

I just see that Rackle has replied, changing the Font of your listbox should be enough. You can make a font-file of your own as well, just open on of the existing ones for a sample. Their format is easy.

And as Rackle suggests, you can change the font with a line line this:
<Property Name="Font" Value="MyFont" /> --layout
setProperty("Font", "MyFont") -- code

Note that the property value is the font's name, not the filename! The name is defined in an xml tag in your .font file.

Good luck! :)

Posted: Fri Jul 13, 2007 23:16
by jchmack
Thank you for the quick replies guys. So i am assuming there is no way to scale up/down one font? I would have to make a font for each size and change it in CEGUI. As easy as it is to make another font it would be increasingly difficult to have many different fonts for different resolutions. So in all i will have f= NumberOfFonts * NumberOfFontSizes. Hopefully i wont have too many fonts which i dont see the need for many.