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

Author Topic: This has been requested before.. but: Multi-line Text alignment  (Read 9989 times)

0 Members and 2 Guests are viewing this topic.

gws923

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
This has been requested before.. but: Multi-line Text alignment
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #2 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 ;)
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #3 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gws923

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #4 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'!

PupperGump

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #5 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.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: This has been requested before.. but: Multi-line Text alignment
« Reply #6 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything