Error loading a font in C ++ with Ogre

1

The code that will show below is on the official Ogre website:   Ogre's official website

I have also seen this query: StackOverFlow English and I used the code to load the font, but it does not work.

My code is this:

   OverlayManager *_overlayMgr = OverlayManager::getSingletonPtr();
    Ogre::Overlay *_overlay = _overlayMgr->create("overlayInfo");
    OverlayContainer* _panel = static_cast<Ogre::OverlayContainer*>(_overlayMgr->createOverlayElement("Panel", "container1"));
    _panel->setDimensions(1, 1);
    _panel->setPosition(0, 0);

    _overlay->add2D(_panel);

    _overlay->show();

    Ogre::OverlayElement *textBox = _overlayMgr->createOverlayElement("TextArea", "txtGreeting");
    textBox->setDimensions(100, 100);
    textBox->setMetricsMode(Ogre::GMM_PIXELS);
    textBox->setPosition(10, 90);
    textBox->setWidth(100);
    textBox->setHeight(100);
    //------------------------------

    //------------------------------
  //  **textBox->setParameter("font_name", "Blue");**
    textBox->
    textBox->setParameter("char_height", "0.3");
    textBox->setColour(Ogre::ColourValue::Green);

    textBox->setCaption("10/40");

    _panel->addChild(textBox);

The line that explodes everything is the one that is commented and in bold, that is, this line:

textBox->setParameter("font_name", "Blue");

The error that appears in the console is as follows:

    Excepción detectada: OGRE EXCEPTION(5:ItemIdentityException): Could not find font MyFont in TextAreaOverlayElement::setFontName at /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/Components/Overlay/src/OgreTextAreaOverlayElement.cpp (line 358)
RUN FINISHED; Segmentation fault; core dumped; real time: 3s; user: 310ms; system: 3s

Note: "Blue" is the same as it appears in Ogre's post as "MyFont".

    
asked by Strelok 15.05.2017 в 14:14
source

0 answers