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

Expand wordwrap options in FlxBitmapText #2722

Merged
merged 6 commits into from
Jan 11, 2024
Merged

Expand wordwrap options in FlxBitmapText #2722

merged 6 commits into from
Jan 11, 2024

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Jan 30, 2023

Fixes #2531

adds the ability to wrap by word with the option of splitting long words.

Deprecates wordWrap and wrapByWord, to be replaced by the new wrap field. which uses the values:

  • NONE - No automatic wrapping, use \n chars to split manually.
  • CHAR - Automatically adds new line chars based on fieldWidth, splits by character.
  • WORD(NEVER) - Only splits lines between words, if a line is too long it will extend beyond the fieldWidth
  • WORD(LINE_WIDTH) - May splits a word if it is too long to fit on one line, otherwise will insert newline chars between words
  • WORD(LENGTH(minChars)) - May splits a word if it is longer than the specified value.
  • WORD(WIDTH(minPixels)) - May splits a word if it is wider than the specified value.

Example

The following shows 3 different messages with 4 different wrap values:

final msg = "The quick brown fox jumps over the lazy dog, ";
final msg1 = msg + "supercala-phragalist-icexpiala-docious"; // hyphens
final msg2 = msg + "supercala-phragalist\nicexpiala-docious"; // \n and hyphens
final msg3 = msg + "supercalaphragalisticexpialadocious"; // one long word
Screen.Recording.2023-01-30.at.9.57.32.AM.mov

@enderpuff
Copy link

That's amazing!

@Geokureli Geokureli added this to the 5.6.0 milestone Dec 13, 2023
@Geokureli Geokureli changed the title Wordwrap Expand wordwrap options in FlxBitmapText Jan 8, 2024
@chosencharacters
Copy link

This is incredible!!!

@Geokureli Geokureli merged commit a52ac47 into dev Jan 11, 2024
30 checks passed
Geokureli added a commit that referenced this pull request Jan 17, 2024
@Geokureli Geokureli deleted the wordwrap branch March 13, 2024 15:21
@Geokureli
Copy link
Member Author

Dear @MSGhero, @chosencharacters wanted me to tell you about this feature added in 5.6.0

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.

FlxBitmapText doesn't split words longer than the fieldWidth
3 participants