Operating System: Windows 10
Render System: DX11
As I'm transitioning from ogre 1.9 to 1.12 I've found that TextAreaOverlayElements don't show spaces anymore unless space_width is set. However, space_width is a rather impractical setting because it's relative to the screen instead of relative to the font size. As is described in the documentation: "Sets the width of a space in relation to the screen." That means that if I use the same font at different sizes, the spaces won't scale with the font size. That's a surprisingly odd design choice and I've never seen any tool do that.
To work around this, I've now implemented a static helper function that sets the width of a space whenever I set the text, based on font size:
Code: Select all
void Tools::setCaption(Ogre::OverlayElement* overlayElement, const std::string& text)
{
if (overlayElement->getTypeName() == "TextArea")
{
auto textArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayElement);
textArea->setSpaceWidth(0.3f) * textArea->getCharHeight());
}
overlayElement->setCaption(text);
}
So I was wondering: does Ogre have a feature to set the width of a space relative to fontsize instead of relative to the screen?