Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: problem with sf::Text getGlobalBounds() / getLocalBounds()  (Read 5223 times)

0 Members and 1 Guest are viewing this topic.

theo

  • Newbie
  • *
  • Posts: 21
    • View Profile
problem with sf::Text getGlobalBounds() / getLocalBounds()
« 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.

theo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
« Reply #1 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)

theo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
« Reply #2 on: September 15, 2021, 03:25:42 pm »
interesting detail: the debugger watch suggests that variable t has no vertices

(click to show/hide)

theo

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: problem with sf::Text getGlobalBounds() / getLocalBounds()
« Reply #3 on: September 16, 2021, 10:44:42 am »