• Advertisement
Sign in to follow this  

TTF font is poor quality

This topic is 1903 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

Hey, im trying to work out why my font output is so pixelated. I don't understand what i am doing wrong... i use the blended option for SDL TTF.

See screen shot for the font output:

http://213.175.192.158/~civilian/img.jpg

I have this as my code:


[source lang="cpp"] TTF_Font *font = NULL;
SDL_Color textColor = { 248, 248, 255 };
font = TTF_OpenFont( "font.ttf", 16 );
if(!font) {
printf("TTF_OpenFont: %s\n", TTF_GetError());
exit(0);
}

SDL_Surface* message = TTF_RenderText_Blended( font, caption.c_str(), textColor );[/source]


I don't know how to fix the issue, any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Default font sizes are usual 12, 18, 24 use one of those values to get perfect result. Else it is to the quality of the font.
Is the font clear around edges? or is it fuzzy around edges / blur ?
If u don't have program to open .ttf files, press "Start" in search bar type "fonts" hit enter
copy your font there and open it from there, and then check how it looks like.
Hope it helps!

Share this post


Link to post
Share on other sites
The font handling routines in Windows are more sophisticated than those in FreeType2 (which is what SDL_TTF uses)... so a malformed TTF or any number of other issues could be causing blitting issues in the TTF rendering library itself.

As a note, I don't see any 'pixelation' in your screenshot aside from the jpeg compression artifacts, so I'm unsure of what issue you're actually describing. Do you mean the distorted outlines? Because that's not pixelation, that's distortion, and that can be explained by my previous statement.

Try using a different font, perhaps a default Windows font, to see if you get different results. If you do, you know you have a font file that may have issues or may be causing issues with FT2. Edited by leeor_net

Share this post


Link to post
Share on other sites

Its the same quality regardless of size i put in the script.

The file and the font itself is crystal clear quality ... observe:


I check the font and image... that's the font you are using since all letters match but Q is so weird...
On the other hand does your string have ' '(white spaces) , if it does try removing them and see what result you get.
Also try moving the drawing position of the font left or right 1 pixel and repeat for up down.

And if that does not help, gimme the source code. I did SDL for some time now and i had issues like this before. Edited by BaneTrapper

Share this post


Link to post
Share on other sites
The image looks like the font was scaled and interpolated after being rendered.

Are you rendering your surface at exactly the correct number of pixels, or is it being scaled? Edited by frob

Share this post


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

  • Advertisement