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

Author Topic: Aligning text of different sizes based on the baseline  (Read 2714 times)

0 Members and 1 Guest are viewing this topic.

m00npirate

  • Newbie
  • *
  • Posts: 18
    • View Profile
Aligning text of different sizes based on the baseline
« on: December 21, 2011, 05:32:06 am »
Images are drawn relative to the upper left corner. Text rendered from a font on the other hand is usually aligned based on the "baseline" of the text which cant be calculated from any available sfml font/text properties. I am currently using the .NET bindings and I would like access to the baseline of a rendered glyph in order to align text of differing sizes. Is there some way of calculating the baseline from SFML or am I better off looking into FreeType bindings for .NET?

Basically what I'm looking for is a function which takes in a string and returns how far the baseline is from the "draw position y coordinate".

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Aligning text of different sizes based on the baseline
« Reply #1 on: December 21, 2011, 08:06:10 am »
The baseline is located at y = CharacterSize relatively to the text's position.
Laurent Gomila - SFML developer

m00npirate

  • Newbie
  • *
  • Posts: 18
    • View Profile
Aligning text of different sizes based on the baseline
« Reply #2 on: December 21, 2011, 08:11:50 am »
Well now I feel silly. Works perfectly, thanks!

 

anything