Skip to content
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

fix: [#2152] SpriteFont and Font alignment #2153

Merged
merged 18 commits into from
Dec 18, 2021

Conversation

eonarheim
Copy link
Member

@eonarheim eonarheim commented Dec 11, 2021

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

Closes #2152

This PR fixes SpriteFont and Font alignment issues by making both of them mostly stateless.

This did happen to uncover some additional bugs in SpriteFont that are fixed in this PR

  1. SpriteFont rotation behaved differently than normal Fonts
  2. SpriteFont's did not support multiple lines like normal Fonts

image

Changes:

  • Added a method measureText on both SpriteFont and Font to return the bounds of the desired text
  • Small tweak to debug system to allow independent position label and position point (made debugging easier)

TODO Before merge

  • Tests
  • Some code cleanup

@eonarheim eonarheim merged commit 67bbf9c into main Dec 18, 2021
@eonarheim eonarheim deleted the bugfix/2152-sprite-font-alignment branch December 18, 2021 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpriteFont is not aligned
1 participant