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

Author Topic: sf::Text horizontal character spacing  (Read 4843 times)

0 Members and 1 Guest are viewing this topic.

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
sf::Text horizontal character spacing
« on: July 21, 2015, 11:36:44 am »
Hi there,
I want to propose a feature that I think sf::Text is missing. Vertical spacing between characters (letter-spacing).
It kept reappearing in a couple of my projects now, so I thought I suggest it. For example there are some fonts that I used of the web. They looks fine on a regular size, but if I scale them up to a very big or down to a very small size, the spacing between characters just doesn't look right anymore. The whole text looks streched/squeezed and it affects the readability (could also be used as an effect thought). It would be nice if you could counter that.
Besides that it would enable people to do bounchy/streching effects with text.
This is nothing excotic and users know this feature from software like GIMP/Photoshop, Word/LibreOffice or from CSS. It's just something you would expect from a multimedia library handeling text.
I have helped myself with a modified version of sf::Text in the past, so there is a tested code ready to go.
What do you guys think?

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: sf::Text horizontal character spacing
« Reply #1 on: July 21, 2015, 12:58:44 pm »
I think you should show your modified code, together with an example program. :-)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Text horizontal character spacing
« Reply #2 on: July 21, 2015, 01:36:33 pm »
That's just an extra offset between glyph quads. Should be really straight-forward to implement.
Laurent Gomila - SFML developer

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: sf::Text horizontal character spacing
« Reply #3 on: July 21, 2015, 02:02:45 pm »
Cool! Yeah that's what I did.
I will clean my code, document it, push it to a separate branch and send a pull request with an example. Maybe I'll have time to do it tonight.

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: sf::Text horizontal character spacing
« Reply #4 on: July 21, 2015, 07:16:44 pm »
Ok. As I promised: Cleaned and documented code in a seperate pull request:)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: sf::Text horizontal character spacing
« Reply #5 on: July 22, 2015, 09:10:12 am »
Thank you :-)