forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SDL_ttf : TTF_RenderUTF8_Blended giving garbled output

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
wich



Joined: 14 Feb 2007
Posts: 13

PostPosted: Wed Feb 14, 2007 6:29 am    Post subject: SDL_ttf : TTF_RenderUTF8_Blended giving garbled output Reply with quote

Hi people, I'm using SDL with SDL_ttf to produce some text in my application, but it seems that something is going wrong and I haven't the slightest idea as to what could be going wrong. Below is the function I am currently using (surf here is the primary video surface):

Code:
inline void drawtext(TTF_Font* font, char* string, size_t x, size_t y, SDL_Color color) {
  SDL_Surface* text = TTF_RenderUTF8_Blended(font, string, color);
  SDL_Surface* text_display_format = SDL_DisplayFormatAlpha(text);
  SDL_FreeSurface(text);
  SDL_Rect dest = {x, y, 0, 0};
  SDL_SetAlpha(text_display_format, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT);
  SDL_BlitSurface(text_display_format, 0, surf, &dest);
  SDL_FreeSurface(text_display_format);
}


All I get is some garbled glyphs, while when I use TTF_RenderUTF8_Solid everything works fine. I've been googling around the net, but I've not been able to find any useful material. Has anybody an idea as to what I'm doing wrong, or can point me in the right direction? I'd also appreciate it if someone could point me to another project that uses TTF_Render*_Blended on the PSP, so that I can compare what I'm doing to other code.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group