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

Author Topic: Character/string width in pixels  (Read 4238 times)

0 Members and 1 Guest are viewing this topic.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Character/string width in pixels
« on: February 06, 2008, 10:01:56 pm »
Hi, is there a way to get the width of a character or a string in pixels? like if there were functions like this:

Code: [Select]
int i;
i = widthInPixels("a");
i = widthInPixels("SFML is great!");


I know you would need to take font size etc. into consideration too but still.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Character/string width in pixels
« Reply #1 on: February 07, 2008, 07:40:39 am »
You can maybe simply use the GetRect function ?
Mindiell
----

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Character/string width in pixels
« Reply #2 on: February 08, 2008, 05:43:18 pm »
Quote from: "Mindiell"
You can maybe simply use the GetRect function ?
Ok, good idea.