Assuming that I have just created the TextItem and have a pointer to it textItem, then I immediately set its text using setText:
Code: Select all
textItem->setText("Hi");
I subsequently try to get the size (in pixels) of this text using
Code: Select all
int width = textItem->getWidth();
The width shows up as 0, in spite of the fact that the text is not zero length. I have tried various things to force the textItem to compute its width, but this does not seem to work. What is the proper way to initialize the text item (so that it has the appropriate width/height? Do I have to call textItem->setWidth(), if so what mechanism is in place for me to compute the width given the text string "Hi"?
I'm using CEGUI with Ogre. I believe it is version 0.4.1 of CEGUI.