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

Author Topic: [SFML2] Bounding boxes around sf::Text characters  (Read 4600 times)

0 Members and 1 Guest are viewing this topic.

codemonkey

  • Newbie
  • *
  • Posts: 2
    • View Profile
[SFML2] Bounding boxes around sf::Text characters
« on: September 26, 2011, 03:08:54 pm »
I'm having a weird issue after upgrading to SFML 2 on OS X (Lion - 10.7.1), i have tried a lot of different things, including trying other fonts (and other font formats), i also  just updated my SFML build to latest commit (0fd992d56e23859f25057ea2878c7e19eced294a) from git.

But i still keep randomly getting bounding boxes around characters:


I'm doing nothing special to draw the text in this example:
Code: [Select]
sf::Text LoadingText;
    LoadingText.SetFont(DeliciousFont);
    LoadingText.SetColor(greenColor);
    LoadingText.SetString("Retreiving information from jukebox...");
    LoadingText.SetCharacterSize(80.0f);
    LoadingText.SetPosition(App.GetWidth() / 2 - LoadingText.GetRect().Width / 2, App.GetHeight() / 2 - LoadingText.GetRect().Height / 2);


Has anyone experienced similar issues? I'm thinking of trying to build the project on windows now, to see if it makes a difference, but i really want it to work on OS X to.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
[SFML2] Bounding boxes around sf::Text characters
« Reply #1 on: September 27, 2011, 02:58:53 am »
Any chance you're messing with OpenGL directly? seems like a possible blending state gone wrong, but at the same time i wouldnt bet on it :)

Maybe its something Mac specific, to which i cant be any help

codemonkey

  • Newbie
  • *
  • Posts: 2
    • View Profile
[SFML2] Bounding boxes around sf::Text characters
« Reply #2 on: September 27, 2011, 02:46:36 pm »
Unfortunaly i'm not doing any calls directly to OpenGL, and as far as i can see.

I'm using the default settings context and this both happens in windowed and fullscreen mode.

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
[SFML2] Bounding boxes around sf::Text characters
« Reply #3 on: September 27, 2011, 03:15:56 pm »
This issue doesn't seem to be exclusive of Mac OS X.
I've had a very similar problem - text with bounding boxes appearing on some characters -  on Linux(I don't remember if it also happened on Windows).
Sadly, I don't know any workarounds.

Haikarainen

  • Guest
[SFML2] Bounding boxes around sf::Text characters
« Reply #4 on: September 27, 2011, 03:19:51 pm »
Set character size to int instead of float (80 instead of 80.0f) and it should work. Had similiar issues with my own tile-manager-class

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SFML2] Bounding boxes around sf::Text characters
« Reply #5 on: September 27, 2011, 09:21:24 pm »
This is a known bug, but unfortunately it hasn't been fixed yet.

Quote
Set character size to int instead of float (80 instead of 80.0f) and it should work

SetCharacterSize takes an integer anyway, so that won't change anything.
Laurent Gomila - SFML developer

efess

  • Newbie
  • *
  • Posts: 1
    • View Profile
[SFML2] Bounding boxes around sf::Text characters
« Reply #6 on: October 04, 2011, 04:10:55 am »
I run into this as well, however only in Debug mode when I have unmanaged debugging enabled in my managed c# project (Visual Studio 2010).

Doesn't happen when this is unchecked, or in release configuration, so it's not really a big issue for me - hope this helps though.

jorgeh

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: [SFML2] Bounding boxes around sf::Text characters
« Reply #7 on: May 20, 2012, 09:08:41 am »
Has anybody found a solution? I'm running into the same problem (also OS X 10.7, SFML 2)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [SFML2] Bounding boxes around sf::Text characters
« Reply #8 on: May 20, 2012, 09:24:13 am »
There's no solution, it's a bug in SFML that hasn't been fixed yet.
Laurent Gomila - SFML developer

DavidJohns

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: [SFML2] Bounding boxes around sf::Text characters
« Reply #9 on: August 28, 2012, 02:08:28 pm »
Just wondering if there has been progress on this and if anyone has discovered some work arounds?  On my machine it is really bad.  Using SFML-2 on Xcode and the template project, just by adding enough text I get boxes around characters.  In the the example below, everything from 1 onwards is bounded.  I'm working on an app that's using tons of text, this could kill it


 if (!font.loadFromFile(resourcePath() + "sansation.ttf"))
        return EXIT_FAILURE;
    sf::Text text("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefg??", font, 30);
    text.setColor(sf::Color::Black);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [SFML2] Bounding boxes around sf::Text characters
« Reply #10 on: August 28, 2012, 04:15:27 pm »
Quote
Just wondering if there has been progress on this and if anyone has discovered some work arounds?
No :(
Laurent Gomila - SFML developer

conleec

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: [SFML2] Bounding boxes around sf::Text characters
« Reply #11 on: September 14, 2019, 02:16:33 am »
I was having the same problem while working thru a tutorial on LinkedIn Learning. Ultimately, I found that if I used a non-fractional number for both the "x" and "y" coordinates as in:

 textObject.setPosition((int)xPos, (int)yPos)

...it would work. Is there anything inherently wrong with doing this? In my case it was only for the "Score =" line, so it didn't really need to move or animate, per se. The reason I had a fractional number in the first place, is because I implemented some code to "scale" the text and position of the text based on the size of the game window.

Chris