• Advertisement
Sign in to follow this  

SDL and Fonts

This topic is 4854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i'm wondering how I would be able to tell how long a line of text is..in say arial (or any font really) The reason I ask is because I want to make a surface that is just long enough to hold the text and no longer are there any such functions that could figure out the length in pixels of a string in a certain font? Or would I have to actually figure out how big (in pixels) each letter is (I don't even know how to do that) and then make a function that figures out the length? thanks

Share this post


Link to post
Share on other sites
Advertisement
Are you using true type fonts or your own font system? Or are you using a lib like SoFont, SDL_TTF, etc? SDL_TTF has a function for finding the length of a string given the font and point size. But then again when SDL_TTF renders a font it renders it to a surface of the needed size automatically.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement