For some reason, the getFormattedLineCount function always returns 1. I'm not sure if I'm using it correctly, or what the problem is. This is my implementation and use of the function:
font = CEGUI::FontManager::getSingleton().createFont( "datafiles/fonts/Celtic-10.font" );
font->defineFontGlyphs(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~æøåÆØÅ" );
// storyBoard1
storyBoard1 = (CEGUI::FrameWindow*)wm->createWindow("TaharezLook/FrameWindow","storyBoard1");
sheet->addChildWindow(storyBoard1);
storyBoard1->setSize(CEGUI::Size( 0.1,0.1 ));
storyBoard1->setPosition(CEGUI::Point( 0.2,0.7 ));
storyBoard1->setTitleBarEnabled(true);
storyBoard1->setSizingEnabled(false);
storyBoard1->setDragMovingEnabled(false);
storyBoard1->setCloseButtonEnabled(false);
storyBoard1->setVisible(true);
storyBoard1->setMouseCursor("WindowsLook", "MouseArrow");
// setup first storyboard
storyBoard1Text = (CEGUI::StaticText*)wm->createWindow("TaharezLook/StaticText","storyBoard1Text");
storyBoard1->addChildWindow(storyBoard1Text);
storyBoard1Text->setSize( CEGUI::Size( 0.95, 0.9 ) );
storyBoard1Text->setPosition( CEGUI::Point( 0.025, 0.05 ) );
storyBoard1Text->setHorizontalFormatting(CEGUI::StaticText::HorzFormatting::WordWrapLeftAligned);
storyBoard1Text->setText("storyBoard1Text");
storyBoard1Text->setVisible(true);
storyBoard1Text->setMouseCursor("WindowsLook", "MouseArrow");
CEGUI::uint x = font->getFormattedLineCount(currentText1,storyBoard1Text->getRect(),CEGUI::TextFormatting::LeftAligned);
currentText1 is:
Man, it sure is hot today! If it wasn't for those pesky headhunters, I'd go lay in the forest!
(sorry for my cheesy text, lol)
Question using getFormattedLineCount(...) function
Moderators: CEGUI MVP, CEGUI Team
- kungfoomasta
- Not too shy to talk
- Posts: 34
- Joined: Wed Apr 06, 2005 08:25
- kungfoomasta
- Not too shy to talk
- Posts: 34
- Joined: Wed Apr 06, 2005 08:25
Re: Question using getFormattedLineCount(...) function
I looked at the code for the function, and found the solution. When I call the function, I use "CEGUI::TextFormatting::LeftAligned". Appearance wise, the sentence is wrapped and tries to stay inside the box. However, the implementation doesn't treat the textFormat as if it's wrapped. If I substitute "CEGUI::TextFormatting::WordWrapLeftAligned" in as the last parameter the function returns 12, which is probably likely since I made a tiny area for the sentence to fit in. So for anybody else using this awesome function (really helpful for me!), make sure the textformatting has the words "WordWrap" in it, otherwise you'll always get 1.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Question using getFormattedLineCount(...) function
Yes, which makes perfect sense; without the word wrapping formatting option, LeftAligned places the text on a single line aligned with the left edge of the formatting area - exactly as described in the API reference.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 12 guests