SFML community forums

General => Feature requests => Topic started by: gws923 on February 09, 2017, 02:28:04 am

Title: This has been requested before.. but: Multi-line Text alignment
Post by: gws923 on February 09, 2017, 02:28:04 am
Hi there.  I'd just like to re-raise this issue.

I would love to be able to have an sf::Text with a multiline string have a function to "center" the text.

In other words
it would look like
this.

It is very much a bummer that I have to use a separate sf::Text for every line of my ~100 line credits...

Any update on this idea?
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: eXpl0it3r on February 09, 2017, 12:58:41 pm
Multi-line text alignment wouldn't look much different than your own custom solution with multiple sf::Text, the only difference is that the later you have to write it. ;)

It's something we might investigate further at one point, but there are a lot more important features and issues to take care of first.
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: Laurent on February 09, 2017, 01:18:49 pm
Quote
Multi-line text alignment wouldn't look much different than your own custom solution with multiple sf::Text, the only difference is that the later you have to write it.
It wouldn't look different, but it would draw with a single vertex array instead of one per line ;)
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: eXpl0it3r on February 09, 2017, 04:21:15 pm
It wouldn't look different, but it would draw with a single vertex array instead of one per line ;)
True, but it felt more like the emphasis was on using multiple sf::Text objects as opposed to having performance issues. ;)
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: gws923 on February 09, 2017, 07:09:11 pm
Multi-line text alignment wouldn't look much different than your own custom solution with multiple sf::Text, the only difference is that the later you have to write it. ;)

It's something we might investigate further at one point, but there are a lot more important features and issues to take care of first.

Word.  I figured it was a low priority sort of issue.  Guess I'll get crackin'!
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: PupperGump on January 19, 2023, 12:39:12 am
Any progress on this yet? I honestly don't see any benefit to using a single text object since you can't adjust the position of the next character without messing with the sf::Text object itself. My other idea was to use whitespace as filler for each newline and remove a space for each character entered, but that's hard to make work.
Title: Re: This has been requested before.. but: Multi-line Text alignment
Post by: Hapax on February 08, 2023, 05:12:17 pm
Feel free to give this a shot:
https://github.com/Hapaxia/SfmlTextAline

It's not fully feature-rich yet (it's missing styles and outline, for example) but it's in a working state.