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.
Questions tagged [sdl-ttf]
208 questions
1
vote
1 answer
Mouse handling SDL2 very slow and sluggish in linux when VSYNC is turned ON
In the event handling loop of SDL2, calling the method SDL_GetMouseState(&x,&y); or using event.motion.x and event.motion.y for the relative mouse coordinates makes SDL2 responsiveness VERY SLUGGISH. Whats weird is SDL_GetMouseState()is alot faster…

peter wilson
- 43
- 6
1
vote
1 answer
How to use UTF8 combining code points with freetype?
Today I learned about "characters" which are made from more than one code point in UTF8. I always believed that one code point in UTF8 maps to a specific character, but it seems like I was wrong.
For example, the following single glyph "é" consists…

Julius
- 1,155
- 9
- 19
1
vote
1 answer
Getting a segfault using TTF_RenderText() when the font is loaded using TTF_OpenFontRW()?
My project is trying to load a font for rendering from a zip file. I use LibZip for accessing the zip, and the procedure I use works fine for all the graphics I'm rendering. However, using the same process for loading a ttf font eventually causes a…

laura
- 51
- 5
1
vote
1 answer
How to improve font quality in SDL ttf and dynamically display text and numbers
I am building a 6502 emulator, and I wish to represent the cpu and memory states visually.
I am using SDL2 for this purpose. I have to render text on the SDL window as the 6502 cpu or memory changes states.
i.e I wish to show the entire memory…

rsonx
- 436
- 7
- 16
1
vote
0 answers
Strange shades of text generated by TTF_RenderText_Blended()?
I try to create texture from surface which is returned by TTF_RenderText_Blended.
I do it in few steps:
Create text texture.
Create 'temporary text texture' just by SDL_CreateTextureFromSurface.
Create 'text texture' by SDL_CreateTexture passing…

Njiuchacz
- 11
- 1
1
vote
1 answer
Blank screen after rendering text
I have opened a window which shows two rects on the screen then using SDL_TTF to show the mouse position on the screen.
The bit I am having hard time understanding is why after rendering text the the two rects before it do not show up.
I am using…

DanM
- 19
- 1
1
vote
1 answer
Where does SDL_TTF look for fonts?
Does TTF_OpenFont have any sort of path or standard install location it looks in, or only in the current working directory?
If the latter – have any conventions been established as to where applications install the TrueType fonts they need? I'm on a…

Joymaker
- 813
- 1
- 9
- 23
1
vote
0 answers
TTF_OpenFont results in windows giving a heap corruption warning
While trying to debug a program for heap corruption errors, I decided to use gflags in the Debugging Tools package for Windows as suggested in this stack overflow post. However, when I try to use this tool and enable full page heap checking by…

Insight
- 33
- 2
- 5
1
vote
1 answer
CLIon - Undefined reference using SDL_TTF
I'm coding a small game and I'm using SDLs libraries for the graphics (with a CLion IDE). I've already downloaded SDL2, SDL2_image and SDL2_ttf. In the code, I include the three libraries and use TTF to make some text:
#include
#include…

LaCumbancha
- 13
- 6
1
vote
1 answer
SDL_TTF rendering garbage to texture
I am attempting to use OpenGL and SDL, using SDL_ttf to render text to a texture, but the code is rendering garbage.
My "Render to texture code":
GLuint textToTexture(std::string & text, TTF_Font* font, glm::vec4 textColour, glm::vec4 bgColour)
{
…

Ian Young
- 1,712
- 1
- 16
- 33
1
vote
1 answer
C++ Access violation when using SDL_ttf with SDL and SDL2
I am using SDL2_ttf with SDL2 (in Visual Studio 2015). When I tried to run the following code,
#include "SDL.h"
#include "SDL_ttf.h"
int main(int argc, char* args[]) {
SDL_Init(SDL_INIT_EVERYTHING);
TTF_Init();
SDL_Window* window;
…

Tempestas Ludi
- 1,113
- 9
- 24
1
vote
1 answer
freeing an SDL_Surface correctly?
Can i free my SDL_Surface* surf by doing this:
SDL_Surface* surf;
for(int i = 0; i < 5; i++){
surf = TTF_RenderText_Blended(foofont, foostring, foocolor);
}
SDL_FreeSurface(surf);
surf = NULL;
Or does this cause memory…

Corné Steenhuis
- 67
- 5
1
vote
1 answer
TTF_RenderText_Solid() Crashing Game and Visual Studio [c++][sdl ttf]
Stack Trace :
So, I'm trying to create a 2D game and right now I'm trying to display and move a image, however when I Debug the game/run it, visual studio and the game freezes and can't quit, not even when using the task manager to kill it.
The…

Happy Crayfish
- 47
- 1
- 11
1
vote
1 answer
Segmentation Fault while loading TTF - SDL2
I'm basically having the same "original" problem that this user was having here: C++ SDL segmentation fault .
However, even after installing the font I am trying to use, I still get a Segmentation Fault as soon as I run the program.
I used gdb to…

Quiver
- 1,351
- 6
- 33
- 56
1
vote
1 answer
SDL2 + OpenGL + SDL2_TTF: Displaying text
I'm having trouble getting a TTF font to draw in OpenGL plus SDL2.0.
I remember that before SDL version 2 I had no problems, but there seems to be a lack of documentation on the subject, perhaps due to the new standard.
I have included the code…

Tavurth
- 21
- 6