SDL_ttf: SDL_GetFontStyle() only return TTF_STYLE_NORMAL in all cases

Hi,
The function SDL_GetFontStyle() always return zero (normal style), and never
italic or bold.
This is tested in all installed fonts in Slacware 13.0.
I need help.-------------------------------------
#include “SDL/SDL.h”
#include “SDL_ttf.h”

main(int argv, char *argc[]){
TTF_Font *font;
int style;

if((SDL_Init(SDL_INIT_VIDEO)==-1))
{
printf("\n\tSDL_Init: %s\n", SDL_GetError());
exit(1);
}

if(TTF_Init()==-1) {
printf("\n\tTTF_Init: %s\n", TTF_GetError());
exit(2);
}

atexit(SDL_Quit);
atexit(TTF_Quit);

font = TTF_OpenFont(argc[1], 10);

if(font == NULL){
printf("\n\tTTF_OpenFont error\n");
exit(3);
}

style=TTF_GetFontStyle(font);

printf(“The font %s, style is:(%d)->”,argc[1],style);

if(style==TTF_STYLE_NORMAL)
printf(" normal");
else {
if(style&TTF_STYLE_BOLD)
printf(" bold");
if(style&TTF_STYLE_ITALIC)
printf(" italic");
if(style&TTF_STYLE_UNDERLINE)
printf(" underline");
}
printf("\n");

//TTF_CloseFont(font);
}

My test command line in linux:

find / -iname “*.ttf” -exec ./stylefont {} ;

SO: Slacware linux 13.0
version lib: SDL_1.2.13, SDL_ttf 2.0.9 (default system libs)

Try out the SDL_ttf 2.0.10 prevew:
http://www.libsdl.org/tmp/SDL_ttf-2.0.10.tar.gzOn Fri, Dec 11, 2009 at 3:34 AM, Ricardo Leite wrote:

Hi,
The function SDL_GetFontStyle() always return zero (normal style), and never
italic or bold.
This is tested in all installed fonts in Slacware 13.0.
I need help.

#include “SDL/SDL.h”
#include “SDL_ttf.h”

main(int argv, char *argc[]){
TTF_Font *font;
int style;

if((SDL_Init(SDL_INIT_VIDEO)==-1))
{
??? printf("\n\tSDL_Init: %s\n", SDL_GetError());
??? exit(1);
}

if(TTF_Init()==-1) {
??? ??? printf("\n\tTTF_Init: %s\n", TTF_GetError());
??? ??? exit(2);
}

atexit(SDL_Quit);
atexit(TTF_Quit);

font = TTF_OpenFont(argc[1], 10);

if(font == NULL){
?? ??? printf("\n\tTTF_OpenFont error\n");
??? exit(3);
}

style=TTF_GetFontStyle(font);

printf(“The font %s, style is:(%d)->”,argc[1],style);

if(style==TTF_STYLE_NORMAL)
??? printf(" normal");
else {
??? if(style&TTF_STYLE_BOLD)
??? printf(" bold");
if(style&TTF_STYLE_ITALIC)
??? printf(" italic");
if(style&TTF_STYLE_UNDERLINE)
??? printf(" underline");
}
??? printf("\n");

//TTF_CloseFont(font);
}

My test command line in linux:

find / -iname “*.ttf” -exec ./stylefont {} ;

SO: Slacware linux 13.0
version lib: SDL_1.2.13,? SDL_ttf 2.0.9 (default system libs)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Yes ! [?]

The bug is fixed in SDL_ttf 2.0.10 version.

Thank you very much !!!
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: image/gif
Size: 541 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20091211/80d95c4e/attachment.gif

You’re welcome! :)On Fri, Dec 11, 2009 at 8:29 AM, Ricardo Leite wrote:

Yes ! [?]

The bug is fixed in SDL_ttf 2.0.10 version.

Thank you very much !!!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: image/gif
Size: 541 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20091211/4b0120c4/attachment.gif