Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Multi-line Text Alignment  (Read 1617 times)

0 Members and 1 Guest are viewing this topic.

Hapax

  • Hero Member
  • *****
  • Posts: 3360
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Multi-line Text Alignment
« on: August 13, 2023, 06:02:22 pm »
Would you be interested in having a simple multi-line alignment for sf::Text?

You may or may not have already seen this:
https://github.com/Hapaxia/SfmlTextAline
where I created something similar to sf::Text that also included a multitude of alignment features.

However, I'm proposing a simple "Left/Center/Right/Justify" choice that would simply affect the entire text globally.
Maybe not even justify if you'd prefer not to have that since it would depend on the type of justification you'd want: "word" justification or "character" justification where "word" only stretches spaces and "character" also separates characters. Of course, you could have both as an option.

The left/center/right option is pretty simple to implement so I'd guess you'd prefer that, if this is a consideration at all, of course.

Let me know and I'll start up a draft...
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Thrasher

  • Moderator
  • Jr. Member
  • *****
  • Posts: 53
    • View Profile
Re: Multi-line Text Alignment
« Reply #1 on: August 18, 2023, 07:15:03 pm »
The ability to wrap text and pick left, right, center, justified alignment would be really nice since as it stands now users are forced to do all that themselves which understandably scares people away from using blocks of text.

Hapax

  • Hero Member
  • *****
  • Posts: 3360
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Multi-line Text Alignment
« Reply #2 on: August 18, 2023, 09:58:17 pm »
Do you think I should target it for SFML 3 (so it's available from 3 onwards) or 2 (so it's available now)?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Thrasher

  • Moderator
  • Jr. Member
  • *****
  • Posts: 53
    • View Profile
Re: Multi-line Text Alignment
« Reply #3 on: August 19, 2023, 06:42:19 am »
SFML 3. We're not accepting SFML 2 features anymore. That means you have full access to anything you want from C++17 which should make it easier to implement.

Hapax

  • Hero Member
  • *****
  • Posts: 3360
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Multi-line Text Alignment
« Reply #4 on: August 20, 2023, 12:53:05 pm »
Okay; thanks! It shouldn't take much implementation anyway so shouldn't need any spectacular C++17 features ;D
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Thrasher

  • Moderator
  • Jr. Member
  • *****
  • Posts: 53
    • View Profile
Re: Multi-line Text Alignment
« Reply #5 on: August 21, 2023, 09:01:23 pm »
Please reach out in the #contributing channel of the Discord server if you have any questions. I'm much easier to find there than on the forums which I check much less often.

Hapax

  • Hero Member
  • *****
  • Posts: 3360
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Multi-line Text Alignment
« Reply #6 on: August 22, 2023, 11:35:36 am »
Sure thing!

I keep forgetting to open Discord. Oops.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything