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

Rename TextAlignment to JustifyText. #10854

Merged
merged 9 commits into from
Dec 5, 2023

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Dec 3, 2023

Objective

The name TextAlignment is really deceptive and almost every new user gets confused about the differences between aligning text with TextAlignment, aligning text with Style and aligning text with anchor (when using Text2d).

Solution

  • Rename TextAlignment to JustifyText. The associated helper methods are also renamed.
  • Improve the doc comments for text explaining explicitly how the JustifyText component affects the arrangement of text.
  • Add some extra cases to the text_debug example that demonstate the differences between alignment using JustifyText and alignment using Style.
    text_debug_2

Changelog

  • TextAlignment has been renamed to JustifyText
  • TextBundle::with_text_alignment has been renamed to TextBundle::with_text_justify
  • Text::with_alignment has been renamed to Text::with_justify
  • The text_alignment field of TextMeasureInfo has been renamed to justification

Migration Guide

  • TextAlignment has been renamed to JustifyText
  • TextBundle::with_text_alignment has been renamed to TextBundle::with_text_justify
  • Text::with_alignment has been renamed to Text::with_justify
  • The text_alignment field of TextMeasureInfo has been renamed to justification

Updated the doc comments for text to reflect this change and added some extra explanation where needed.

The `text_debug` example has been updated to include examples of `TextJustication`.
@ickshonpe ickshonpe added C-Examples An addition or correction to our examples C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Text Rendering and layout for characters and removed C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Dec 3, 2023
@ickshonpe ickshonpe changed the title Rename TextAlignment to TextJustification. Rename TextAlignment to JustifyText. Dec 4, 2023
@ickshonpe
Copy link
Contributor Author

TextJustification is too long and very easy to mistype, so changed it again to JustifyText

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Dec 5, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 5, 2023
Merged via the queue into bevyengine:main with commit 166686e Dec 5, 2023
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Text Rendering and layout for characters C-Code-Quality A section of code that is hard to understand or change C-Examples An addition or correction to our examples M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants