Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jun 20, 2013 1:31 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Font issues?
PostPosted: Thu Mar 22, 2012 10:42 pm 
Offline

Joined: Thu Mar 22, 2012 9:48 pm
Posts: 3
ok so I've been playing around with TWL and Slick trying to get some text to display on a label. And I've managed that much but I've encountered an oddity where it seems that TWL will not properly grab the size of fonts. For some reason the FPScounter seems to work properly, and can display a border properly (sized etc). but if I try to create a label I have to manually set the box width, it wont automatically check the length of the text. furthermore, when I get the width of the box it always returns 0 for all of the widths, and if I get the font from the label theme, and getEM() it returns 0..

checking the font file shows that the widths/heights on all the characters are correct (and they display properly too). So I'm kind of at a loss as to why this is happening.


Top
 Profile  
 
 Post subject: Re: Font issues?
PostPosted: Fri Mar 23, 2012 5:29 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1190
Can you upload the font files? Did you use the Theme Editor to generate it?

Regarding widget sizes: getWidth() and getHeight() only return useful values after layout.
You should use getPreferredWidth and getPreferredHeight().

And when you put the label in a widget which correctly handles layout() then the layout method should be invoked when ever the text of the label was changed.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
 Post subject: Re: Font issues?
PostPosted: Sat Mar 24, 2012 1:12 am 
Offline

Joined: Thu Mar 22, 2012 9:48 pm
Posts: 3
ok, so I figured that portion out last night. And got everything to work, it was definitely an issue of attempting to get the values before doing the layout.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group