Sign in to follow this  

openning ttf

This topic is 3669 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 am moving to Suse 10.3 from 10.2 ( 64 bit ). I am using kDevelop for the editor but I did not use kDevelop to set up the project. I used my make file from a command line build. I would like to use kDevelop fully but not sure how to add like freetype and such to the overall project - any side link here? I copied my entire project folder over to my new machine and had build errors. I am down to one and I am unsure what to look for. From another post I found I had to add -lfreetype to my make file though it was not needed on the 10.2 machine(s) but that fixed my one set of errors. I went to my 10.2 machine and added the library and it still built and run just fine. I got a warning next about not using const char * instead of char * so I changed this. I cannot open the font though. If I comment out openning the font my program runs - with out fonts. I have : // -------------------------- // Text stuff // -------------------------- const char *Font_Name = "fonts/FreeSerif.ttf"; int Font_style = TTF_style_NORMAL ;//| TTF_style_ITALIC ; int Font_Size = 42 ; and make the call: font = TTF_OpenFont( Font_Name, Font_Size ); if(!font) { fprintf( logPtr, "TTF OpenFont failed: %s ", TTF_GetError()); fprintf( logPtr, "%s\n", Font_Name); Quit(-3); } fprintf( logPtr,"%s opened \n", Font_Name); I also tried : font = TTF_OpenFont( "fonts/FreeSerif.ttf", Font_Size ); but each give me a segmentation fault. The font is there in the folder and seems in good. My log file is not updated I guess because the error shuts down the program without closing the file but I get marker / error messages in my log file if I comment the font creation and quit jump out. Thoughts to what I am missing? Thanks Kumado

Share this post


Link to post
Share on other sites
Yes I am and that is my problem. I got so fixated on the :

text.cpp:39: warning: deprecated conversion from string constant to ‘char*’

that I assumed it was the font name issue that was giving me errors. When I started doing more testing I realized TTF_Init is not working. Sorry for the premature post. I need to see what has changed to not allow ttf to initialize. Freetype and all seems to be installed but...

making the call :
if( TTF_Init( ) == -1 )
{
fprintf( logPtr, "TTF Init failed: %s\n", TTF_GetError());
Quit( -2 );
}
is what gives me the fault. I commented out the fprintf line thinking it could be the TTF_GetError() since TTF_Init fails but it still segment faults.

Thanks, back to more digging.

Kumado

Share this post


Link to post
Share on other sites
Deep breaths - too many irons in the fire too.

Teaching this year has been such a loss. Been more baby-sitting than anything.

I finally got it back up. I reinstalled the freetype and sdl_ttf libs and it worked fine.
I had on additional problem to get out of the way but I am back in gear once again.

Thanks much for all the help.

Kumado

Share this post


Link to post
Share on other sites

This topic is 3669 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this