New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify sf::Text::getLocalBounds() to behave more intuitively #216

Closed
Bromeon opened this Issue Apr 29, 2012 · 8 comments

Comments

Projects
None yet
4 participants
@Bromeon
Member

Bromeon commented Apr 29, 2012

With its current semantics, getLocalBounds() is not very useful. For example, it depends on single character heights and ignores leading or trailing whitespaces.

Forum threads:
http://en.sfml-dev.org/forums/index.php?topic=7174
http://en.sfml-dev.org/forums/index.php?topic=6672
http://en.sfml-dev.org/forums/index.php?topic=7156

@ghost ghost assigned LaurentGomila Apr 29, 2012

@eXpl0it3r

This comment has been minimized.

Show comment
Hide comment
Member

eXpl0it3r commented May 30, 2012

@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila Jun 18, 2013

Member

Actually, as long as you take in account the left and top coordinates of the text's bounding rect (which are non-zero, unlike other entities), everything works as expected.

If someone still has a problem, even when left/top coordinates are considered, please post here your use case.

So for now, we're left with just the whitespace issue.

Member

LaurentGomila commented Jun 18, 2013

Actually, as long as you take in account the left and top coordinates of the text's bounding rect (which are non-zero, unlike other entities), everything works as expected.

If someone still has a problem, even when left/top coordinates are considered, please post here your use case.

So for now, we're left with just the whitespace issue.

@Wizzard033

This comment has been minimized.

Show comment
Hide comment
@Wizzard033

Wizzard033 Jun 29, 2013

This could really use being fixed.

Wizzard033 commented Jun 29, 2013

This could really use being fixed.

@Wizzard033

This comment has been minimized.

Show comment
Hide comment
@Wizzard033

Wizzard033 Jun 29, 2013

Also, could you expand on what you mean by using the left/top coordinates?

Wizzard033 commented Jun 29, 2013

Also, could you expand on what you mean by using the left/top coordinates?

@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila Jun 29, 2013

Member

Also, could you expand on what you mean by using the left/top coordinates?

I mean doing rect.left + rect.width / 2 to find the center of the bounding rect instead of rect.width / 2, which assumes that rect.left is zero which is generally false for sf::Text.

Member

LaurentGomila commented Jun 29, 2013

Also, could you expand on what you mean by using the left/top coordinates?

I mean doing rect.left + rect.width / 2 to find the center of the bounding rect instead of rect.width / 2, which assumes that rect.left is zero which is generally false for sf::Text.

@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila Jul 10, 2013

Member

There is still the whitespace issue to fix though.

Member

LaurentGomila commented Jul 10, 2013

There is still the whitespace issue to fix though.

@Wizzard033

This comment has been minimized.

Show comment
Hide comment
@Wizzard033

Wizzard033 Jul 10, 2013

I am currently using http://en.sfml-dev.org/forums/index.php?topic=7174 but I don't even think it works properly (although more thorough testing to make sure the bug does not originate elsewhere is necessary). I have to add artificial padding currently to keep text in my GUI text boxes because no proper function exists to measure the text.

Wizzard033 commented Jul 10, 2013

I am currently using http://en.sfml-dev.org/forums/index.php?topic=7174 but I don't even think it works properly (although more thorough testing to make sure the bug does not originate elsewhere is necessary). I have to add artificial padding currently to keep text in my GUI text boxes because no proper function exists to measure the text.

@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila Jul 11, 2013

Member

Please provide a complete and minimal code that reproduces your problem. And as I said, you don't need the workaround shown in that thread if you use the bounding rectangle correctly. So you should also show what you tried with that.

Member

LaurentGomila commented Jul 11, 2013

Please provide a complete and minimal code that reproduces your problem. And as I said, you don't need the workaround shown in that thread if you use the bounding rectangle correctly. So you should also show what you tried with that.

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