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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - assematt

Pages: [1]
1
Graphics / Re: bug in sf::Text when applying an outline color/thickness
« on: December 21, 2016, 07:18:12 pm »
I updated the code to better support \r\n as new line char without a graphic glitch.
Now sf::Text should not produce unwanted graphics glitches when using an outline color/thickness if the sf::Text string contains two consecutive new line character.

Here some screen for comparison, the text on the left is produced by the old code, the on on the right is produced by the new code

sf::Text TestString;
TestString.setFont(TestFont);
TestString.setCharacterSize(60u);
TestString.setOutlineColor(sf::Color::Red);
TestString.setOutlineThickness(2.f);
TestString.setStyle(sf::Text::StrikeThrough | sf::Text::Underlined);
TestString.setString("Line 1\r\nLine 2");




sf::Text TestString;
TestString.setFont(TestFont);
TestString.setCharacterSize(60u);
TestString.setOutlineColor(sf::Color::Red);
TestString.setOutlineThickness(2.f);
TestString.setStyle(sf::Text::StrikeThrough | sf::Text::Underlined);
TestString.setString("Line 1\r\n\r\nLine 2");

2
Graphics / Re: bug in sf::Text when applying an outline color/thickness
« on: December 16, 2016, 08:29:07 pm »
Also as eXpl0it3r pointed out in the pull request on github that SFML only correctly support '\n' as a new line character in the ensureGeometryUpdate() function, if we have '\r\n' as a new line character that the ensureGeometryUpdate() function adds an extra blank character in the vertex array. So I updated the code to support also \r\n as new line character. That said isn't it better to just convert the new line characters when calling setString() from \r\n to \n?

This is a visual representation of the bug when using \r\n.

3
Graphics / bug in sf::Text when applying an outline color/thickness
« on: December 16, 2016, 05:37:45 pm »
When applying an outline thickness to sf::Text in combination with a strikethrough and/or an underlined style, the ensureGeometryUpdate function adds unwanted vertices if the string contains two consecutive '\n' charecter. To fix this we need to add an additional check in the if statements to check if both the current and previous character it's a new line character.

This is a visual representation of the bug


And this is the code that generated it.

sf::Text TestString;
TestString.setFont(TestFont);
TestString.setCharacterSize(60u);
TestString.setOutlineColor(sf::Color::Red);
TestString.setOutlineThickness(2.f);
TestString.setStyle(sf::Text::StrikeThrough | sf::Text::Underlined);
TestString.setString("Line 1\n\nLine 2");

This is the portion of code that generated the bug.
(click to show/hide)

And this is the fixed one
(click to show/hide)

Pages: [1]
anything