Skip to content

Fix corelation between text setOutlineThickness() and getLocalBounds()#2132

Merged
eXpl0it3r merged 1 commit into
SFML:2.6.xfrom
oomek:bugfix/text_local_bounds
Oct 1, 2022
Merged

Fix corelation between text setOutlineThickness() and getLocalBounds()#2132
eXpl0it3r merged 1 commit into
SFML:2.6.xfrom
oomek:bugfix/text_local_bounds

Conversation

@oomek

@oomek oomek commented Jun 13, 2022

Copy link
Copy Markdown
Contributor

This fixes text crawling explained in issue #2129

Thanks a lot for making a contribution to SFML! 🙂

Before you create the pull request, we ask you to check the follow boxes. (For small changes not everything needs to ticked, but the more the better!)

  • Has this change been discussed on the forum or in an issue before?
  • Does the code follow the SFML Code Style Guide?
  • Have you provided some example/test code for your changes?

Description

Please describe your pull request.

This PR is related to the issue #2129

Tasks

  • Tested on Linux
  • Tested on Windows
  • Tested on macOS
  • Tested on iOS
  • Tested on Android

How to test this PR?

Example code provided in the issue linked above

Comment thread src/SFML/Graphics/Text.cpp Outdated
@oomek oomek force-pushed the bugfix/text_local_bounds branch from 5f9546b to 50da655 Compare June 13, 2022 16:43
@codecov

codecov Bot commented Jun 13, 2022

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (2.6.x@2bca810). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head b400d16 differs from pull request most recent head 5d6e323. Consider uploading reports for the commit 5d6e323 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             2.6.x    #2132   +/-   ##
========================================
  Coverage         ?   13.90%           
========================================
  Files            ?      189           
  Lines            ?    15810           
  Branches         ?     4169           
========================================
  Hits             ?     2199           
  Misses           ?    13457           
  Partials         ?      154           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bca810...5d6e323. Read the comment docs.

Comment thread src/SFML/Graphics/Text.cpp Outdated

@vittorioromeo vittorioromeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, would like to see a before/after picture in a noticeable case with a large outline. Also, would we need to do the same for shapes?

Comment thread src/SFML/Graphics/Text.cpp
@oomek

oomek commented Jun 15, 2022

Copy link
Copy Markdown
Contributor Author

Seems reasonable, would like to see a before/after picture in a noticeable case with a large outline. Also, would we need to do the same for shapes?

I'm not sure what you mean. You have to run the example code provided to understand what it's about. The screenshots won't tell you the story I'm afraid, as they will look the same with, or without random 1 pixel X offset.

@eXpl0it3r

Copy link
Copy Markdown
Member

I think the example is okay to demonstrate the issue + fix.

For me the main question is, whether there's something that speaks against including it, just so we don't "fix" something that was intentionally designed that way. But if nobody knows about it, then it should be fine for me as well.

@oomek oomek force-pushed the bugfix/text_local_bounds branch from 50da655 to 4a317fe Compare June 24, 2022 16:00
@ChrisThrasher

Copy link
Copy Markdown
Member

@oomek Would you please resolve the merge conflicts in this PR? #2159 meant that pretty much every outstanding PR now has merge conflicts with master.

@oomek oomek force-pushed the bugfix/text_local_bounds branch from 4a317fe to b400d16 Compare July 19, 2022 00:20
@eXpl0it3r

Copy link
Copy Markdown
Member

Do you just want to fix this on master or also for 2.6.x?

@oomek

oomek commented Sep 29, 2022

Copy link
Copy Markdown
Contributor Author

Yes, also on 2.6.x please.

@eXpl0it3r

Copy link
Copy Markdown
Member

Do you want to retarget it or shall I? 😄

@oomek

oomek commented Sep 30, 2022

Copy link
Copy Markdown
Contributor Author

Please do. I'm not going to be in front of my PC today.

@eXpl0it3r eXpl0it3r changed the base branch from master to 2.6.x September 30, 2022 18:34
@eXpl0it3r eXpl0it3r force-pushed the bugfix/text_local_bounds branch from b400d16 to 5d6e323 Compare September 30, 2022 18:34
@eXpl0it3r eXpl0it3r added this to the 2.6 milestone Sep 30, 2022
@eXpl0it3r eXpl0it3r linked an issue Sep 30, 2022 that may be closed by this pull request

@ChrisThrasher ChrisThrasher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the example myself, I can observe this PR making things significantly smooth when scaling the outline up and down. Thank you!

@eXpl0it3r eXpl0it3r merged commit 2db1235 into SFML:2.6.x Oct 1, 2022
@eXpl0it3r

Copy link
Copy Markdown
Member

Thanks for the fix! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sf::Text::getLocalBounds() inconsistency

5 participants