SFML community forums

Help => Graphics => Topic started by: theo on September 15, 2021, 02:35:43 pm

Title: problem with sf::Text getGlobalBounds() / getLocalBounds()
Post by: theo on September 15, 2021, 02:35:43 pm
I take the bounds of an sf::Text object:

sf::Text t{};
t.setFont(m_font);  // yes, m_font is loaded and in scope at this point
t.setString("Hello world");
t.setCharacterSize(20);
auto bounds = t.getGlobalBounds();  // same behaviour with getLocalBounds()

This used to work fine, but now I get the following error:

Exception thrown at 0x00007FFCCAAD2B8D (freetyped.dll) in test.exe: 0xC0000005: Access violation reading location 0x0000000000000008.

The only thing that seems to have changed is an upgrade of freetype to version 2.11.0 (through vcpkg). This might be more a bug in freetype than in SFML, but I can't really tell.
Title: Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
Post by: theo on September 15, 2021, 02:59:58 pm
The problem seems to be deeper: sf::Text also doesn't draw properly anymore. Very minimal program:

(click to show/hide)

Compiled with visual studio 16.11.3

Installed libraries (via vcpkg):
(click to show/hide)
Title: Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
Post by: theo on September 15, 2021, 03:25:42 pm
interesting detail: the debugger watch suggests that variable t has no vertices

(click to show/hide)
Title: Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
Post by: theo on September 16, 2021, 10:44:42 am
I see that this is a duplicate for https://en.sfml-dev.org/forums/index.php?topic=28213.0