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

Author Topic: Text character size documentation  (Read 2625 times)

0 Members and 1 Guest are viewing this topic.

Ant

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Text character size documentation
« on: March 08, 2015, 07:39:48 pm »
Hello,

I would like to request for further information on the Text class's character size.  I've read up the documentation from:
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Text.php

Unfortunately, the description of the character size functions did not provide the answer I was searching for.  What is the character size measuring?  Vertical length of a character (if so, what's the difference between font's line spacing and this)?  Horizontal length of a character (if so, how does it handle characters such as "l" and "M")?

Thanks for your consideration.
« Last Edit: March 08, 2015, 08:16:58 pm by Ant »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: Text character size documentation
« Reply #1 on: March 09, 2015, 09:45:45 am »
Make sure to look at the latest documentation.

Quote
unsigned int sf::Text::getCharacterSize() const
Get the character size.

Returns
Size of the characters, in pixels

The horizontal length obviously depends on the used font.
I'm not really sure what information you're looking for.
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: 32504
    • View Profile
    • SFML's website
    • Email
Re: Text character size documentation
« Reply #2 on: March 09, 2015, 09:50:03 am »
He wants to know this is the size of what. And indeed this is not very clear. Even for me. I'll have to check before answering, but as far as I remember this is the total height of the tallest glyph.

However, I wonder in which case you really need to know exactly what it refers to. When you select a font size in a text editor, you don't know what it is either, you just try and take the size that best fits what you want to do.
Laurent Gomila - SFML developer

Ant

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: Text character size documentation
« Reply #3 on: March 10, 2015, 02:58:36 am »
Thank you for the heads up, Exploiter.  I'll be sure to update my bookmarks to reference the latest documentation.

The reason why I ask about character size is to ensure that text does not go beyond boundaries for functions that handle horizontal/vertical alignment, text wrapping, and clamping.  I do hope some time in the future, I'll be able to demonstrate how my UI module appears, but I still have much work to do.