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

Author Topic: Copying of sf::Fonts fails  (Read 10630 times)

0 Members and 1 Guest are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Copying of sf::Fonts fails
« on: February 19, 2010, 03:22:30 pm »
Hey,

when copying fonts, the destination object is somehow invalid. I guess something doesn't get copied properly.

Minimal example:
#include <SFML/Graphics.hpp>

int main() {
        sf::RenderWindow  window( sf::VideoMode( 800, 600, 32 ), "Muh" );

        sf::Font  afont;

        {
                sf::Font  tmpfont;
                tmpfont.LoadFromFile( "whatever.ttf" );
                afont = tmpfont;
        }

        sf::Text  text( L"Foo", afont, 50 );

        window.Clear();
        window.Draw( text );
        window.Display();

        sf::Sleep( .5f );
}
 

Backtrace:
Code: [Select]
#0  0x00007ffff5cfd1d5 in FT_Request_Size () from /usr/lib/libfreetype.so.6
#1  0x00007ffff5cfd295 in FT_Set_Pixel_Sizes () from /usr/lib/libfreetype.so.6
#2  0x00007ffff76dfce4 in sf::Font::SetCurrentSize(unsigned int) const () from /usr/local/lib/libsfml-graphics.so.2.0
#3  0x00007ffff76e0d0f in sf::Font::LoadGlyph(unsigned int, unsigned int, bool) const () from /usr/local/lib/libsfml-graphics.so.2.0
#4  0x00007ffff76e109c in sf::Font::GetGlyph(unsigned int, unsigned int, bool) const () from /usr/local/lib/libsfml-graphics.so.2.0
#5  0x00007ffff76ec835 in sf::Text::Render(sf::RenderTarget&, sf::Renderer&) const () from /usr/local/lib/libsfml-graphics.so.2.0
#6  0x00007ffff76e785a in sf::RenderTarget::Draw(sf::Drawable const&) () from /usr/local/lib/libsfml-graphics.so.2.0
#7  0x0000000000402bd1 in main () at s.cpp:19

This happens in the line with "window.Draw()", but everything else that accesses the font's properties leads to this error, too.

SFML is version 2, revision 1412 on Debian GNU/Linux.
« Last Edit: May 07, 2012, 02:58:28 pm by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Copying of sf::Fonts fails
« Reply #1 on: February 19, 2010, 03:30:07 pm »
Nice bug :)

I check that right now.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Copying of sf::Fonts fails
« Reply #2 on: February 19, 2010, 03:38:37 pm »
Fixed.

Thanks for your feedback and for the code :)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Copying of sf::Fonts fails
« Reply #3 on: February 19, 2010, 03:49:52 pm »
No problem, been a pleasure. ;) Thanks for the fast fix.

 

anything