TGUI Forum

General Category => Help requests => Topic started by: robvleugel on 25 July 2013, 16:16:02

Title: Regular / bold text
Post by: robvleugel on 25 July 2013, 16:16:02
(https://imageshack.us/a/img12/1717/smxt.png)

As you can see the right text appears bold while the left text is not, any idea what might be causing this?

Code: [Select]
    m_gui.setGlobalFont("Fonts\\Cousine-Regular-Latin.ttf");

    //buttonQuit
    m_buttonQuit.init(m_gui);
    m_buttonQuit->load(m_config.guiTheme);
    m_buttonQuit->setSize(100, 30);
    m_buttonQuit->setPosition(900, 730);
    m_buttonQuit->setText("Quit");

    //buttonMenu
    m_buttonMenu.init(m_gui);
    m_buttonMenu->load(m_config.guiTheme);
    m_buttonMenu->setSize(100, 30);
    m_buttonMenu->setPosition(24, 730);
    m_buttonMenu->setText("Menu");

Title: Re: Regular / bold text
Post by: texus on 25 July 2013, 16:56:37
You don't set a text size, which means the button is allowed to choose the best fitting size.
It probably takes a different size for the words menu and quit (although I would expect menu to have a slightly larger size).

Try giving both buttons a fixed size with setTextSize (you can use getTextSize in your code to find out the size that it is currently using).
Title: Re: Regular / bold text
Post by: robvleugel on 25 July 2013, 18:55:33
That was indeed the problem, thanks