Questions tagged [sdl-ttf]

This is a sample library which allows you to use TrueType fonts in your SDL applications. It comes with an example program "showfont" which displays an example string for a given TrueType font file.

208 questions
4
votes
1 answer

Getting SDL_ttf to play nice with SDL2

I've recently started migrating from using SDL (1.2.15) to SDL2 (2.0.0), and had previously depended on using the extension library SDL_ttf (2.0.11) to render fonts. When I try to use the same text library I used with version one SDL with SDL2…
B. Elliott
  • 181
  • 1
  • 6
4
votes
1 answer

OpenGL, SDL_ttf

I have trouble with display text in OpenGL through SDL_ttf. I have written LoadFont() function which loads font and makes OpenGL texture. int LoadFont( char *name, GLubyte r, GLubyte g, GLubyte b, char *text, int ptsize) { SDL_Color color = {r, g,…
amidnikmal
  • 86
  • 3
  • 9
4
votes
2 answers

Trying to install SDL_ttf in Visual Studio Express 2012 for Windows Desktop

I am trying to install SDL_ttf in Visual Studio Express 2012 for Windows Desktop and I have a small sample program that compiles fine, but when I run it, I get an error popup that says "The application was unable to start correctly (0xc000007b).…
user1296259
  • 521
  • 1
  • 13
  • 33
4
votes
1 answer

Using SDL_ttf and OpenGL, TTF_RenderUTF8_Blended print Red rectangle

When I render my text using TTF_RenderUTF8_Blended I obtain a solid rectangle on the screen. The color depends on the one I choose, in my case the rectangle is red. My question What am I missing? It seems like I'm not getting the proper Alpha…
ForceMagic
  • 6,230
  • 12
  • 66
  • 88
3
votes
1 answer

How do I join up (Arabic) glyphs with SDL-TTF v2.20?

SDL_TTF 2.20.0 (with Harfbuzz enabled) introduced TTF_SetFontDirection() and TTF_SetFontScriptName() "for additional control over fonts using HarfBuzz". I am trying to render some Arabic text, and I have set the font direction to RTL and the script…
Tim Orton
  • 329
  • 3
  • 14
3
votes
1 answer

SDL_TTF system font

Is there any way to use the default system font with SDL_TFF, without writing platform-specific code? Currently I just use one of the GNU FreeFont's, but I would like to be able to use the default system font.
orlp
  • 112,504
  • 36
  • 218
  • 315
3
votes
2 answers

SDL_ttf not working in codeblocks

how do you set up sdl_ttf in codeblocks? Ive read lazyfoo's tutorial about adding new libraries to sdl, and have successfully added sdl_image to it. however, ttf refuses to work. i have downloaded the files, put the header file in the sdl folder,…
3
votes
1 answer

Printing text causes memory leak

I want to print health information on my screen for a game using SDL ttf but i get a memory leak. The game starts and works for a while (with text and all) but after a few seconds it stops. Normally you should free the textSurface after running…
Albin Gjoka
  • 305
  • 1
  • 2
  • 14
3
votes
0 answers

TTF_OpenFont returns "library not initialized" error

I try to open a font via the SDL_OpenFont() function, but it returns nullptr and TTF_GetError() returns "Library not initialized". SDL_Init(SDL_INIT_EVERYTHING) and TTF_Init() both return 0. if(SDL_Init(SDL_INIT_EVERYTHING) < 0) { std::cout <<…
svloyso
  • 133
  • 1
  • 6
3
votes
2 answers

How do I check for SDL2_ttf in CMakeLists.txt?

I am currently writing an SDL2 program with the SDL2-ttf library and wanted to add a check for it in CMakeLists.txt. How do I do that? I am using CMake 3.1.
LocalToast
  • 397
  • 1
  • 5
  • 13
3
votes
1 answer

Sdl_ttf Text Wrapping

When a string of text goes past say, 300 in length, I want it to drop to a new line and continue. I read that this is how you do it but it's not working - it is just stretching out the text. How to achieve this? const char* message = "example text…
Oblivion
  • 585
  • 2
  • 8
  • 26
3
votes
1 answer

SDL_ttf - Font directory/Where do fonts go?

I've been noodling around with SDL and OpenGL (in C++), and decided to get some text into my game. I've followed a few tutorials, but I always get the same error: "Couldn't find .ttf" I'm sure it's been asked before, but where should you place the…
Matt Reynolds
  • 787
  • 2
  • 9
  • 22
3
votes
3 answers

Rendering text with a single font texture (SDL + OpenGL)

I've been searching and testing around with new ways to render text with OpenGL, loading the its textures with SDL, but every technic I test it seems to be expensive and slow. Thinking about it I realized that maybe the best way to implement it is…
Edmo Freitas
  • 64
  • 1
  • 7
2
votes
1 answer

Memory leak with SDL2

So here's the problem, I have a function that allows you to display text in a renderer, I implemented it in a project, I later wanted to test this project against a possible memory leak and bingo! After some time of research it came from this famous…
Bigfoot71
  • 63
  • 1
  • 6
2
votes
0 answers

sdl2_ttf configure error finding free type 2 lib

I'm trying to install the SDL2_ttf library using the command line but not find how the configure process find the free type 2 previously installed. checking for FreeType -- version >= 7.0.1... no configure: WARNING: The freetype-config script…
Jorge Vega Sánchez
  • 7,430
  • 14
  • 55
  • 77
1
2
3
13 14