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
2
votes
1 answer

SDL2_ttf Subpixel Antialiasing

Is it possible to render text with the SDL2 library using a subpixel rendering technique to increase the quality on LCD screens? (Preferably with standard SDL2_ttf.) The following image demonstrates precisely what I'm aiming for, where the image on…
Michael
  • 115
  • 10
2
votes
1 answer

Why are my SDL_ttf fonts so pixelated and ugly? Are there better ways of rendering fonts?

Here is an example: Here is the corresponding code: TTF_Font *Sans = TTF_OpenFont("resources/fonts/lato/Lato-Semibold.ttf", 36); if( Sans == NULL ) { std::cout << "Failed to load font! SDL_ttf Error: " << TTF_GetError() <<…
ubadub
  • 3,571
  • 21
  • 32
2
votes
2 answers

SDL memory leak

So I tryed to make something on SDL, but on first programm I have memory lear (idk leak or not) so there is some code: #include #include #include #include #define SCREENSIZEX 180 #define SCREENSIZEY…
Maxim Zhuchkov
  • 141
  • 1
  • 10
2
votes
1 answer

SDL_ttf textures in vector affects other's destination rectangle

I was following Lazy Foo' tutorial to create text using ttf font, and everything was fine, but I needed to create several text lines in several different places with different font size and color, so I decided to use vector. Here is my code of…
SuperPrower
  • 111
  • 1
  • 12
2
votes
1 answer

Rendering font with UTF8 in SDL_ttf

I am trying to render characters using the TTF_RenderUTF8_Blended method provided by the SDL_ttf library. I implemented user input (keyboard) and pressing 'ä' or 'ß' for example works fine. These are special characters of the German language. In…
huzzm
  • 489
  • 9
  • 24
2
votes
2 answers

SDL_TTF : undefined reference to "TTF_INIT"

I'm trying to learn how to use SDL_TTF library. But i'm unable to solve an error of type : undefined reference to "TTF_INIT" here is the simple code that im trying to compile and use : #include #include #include…
venilla
  • 61
  • 1
  • 9
2
votes
4 answers

SDL_ttf "Couldn't load font file" with SDL2 in c++

I have the following code to draw some text in an SDL2 application. When I build and run, I'm consistently seeing an error of TTF_OpenFont() Failed: Couldn't load font file. I've tried the following: Ensured the font file is in the current…
msegreto
  • 69
  • 2
  • 3
2
votes
0 answers

Rendering specific characters within a string different colors (SDL_ttf)

So I have 25 lines of text with 40 characters per line held in an array of strings, and within that there are control codes which denote a colour which the following chars should be, for example one line may be: [RED] Hello [BLUE] World Where Hello…
Finlandia_C
  • 385
  • 6
  • 19
2
votes
1 answer

SDL_TTF slow printing effect

So, I'm working on a command prompt game, and right now I'm starting small. I've gotten the basics down for a slow printing text system, but I've encountered a problem that I'm unsure how to fix. Basically; the text stretches to fit the predefined…
genfy
  • 83
  • 3
  • 4
  • 18
2
votes
1 answer

Why am I unable to draw to a texture in SDL2?

I've been working on a project in SDL on nights and weekends for the past few months. I'm currently trying to get a menu system working. At the moment, I'm working on drawing text using SDL_TTF. As for my question, I'm seeing some strange behavior…
2
votes
1 answer

SDL show score on screen

Working on a Pong clone. Having serious issues with trying to display the score on the screen. Alot of things I've found are using images but I just want to use text to display the score number. I'm trying to use the SDL TTF library to load a font…
CharlieFan39
  • 29
  • 1
  • 3
  • 6
2
votes
0 answers

Odd behavior with unsigned 16 bit integers and SDL_TTF

I'm writing a program that renders font in SDL. I have a struct with the color and text of a 'pixel.' It causes a segmentation fault, and I can't make any sense of it. struct pixInfo { SDL_Color bColor; SDL_Color tColor; Uint16…
user3103398
  • 143
  • 9
2
votes
1 answer

TTF_OpenFont fails on Nth attempt

I'm trying to make a game in C using SDL_ttf to display the score every time the diplay is refreshed. The code looks like : SDL_Surface *score = NULL; TTF_Font *font; SDL_Color color = { 255, 255, 255 }; font = TTF_OpenFont(…
Zeenoth
  • 23
  • 2
2
votes
2 answers

Make_Pair identifier not found in one function but found in another

I’m trying to make a dictionary of fonts with SDL_ttf, just like I made a dictionary with SDL_image. Since fonts are stored with a pnt_size I made a struct containing this info: struct fontinfo { string assetname; int size; …
M4st3rM1nd
  • 207
  • 3
  • 12
2
votes
1 answer

SDL TTF not showing ellipsis on some fonts

On some fonts, I can't get SDL_TTF to render some glyphs (such as …), even when I know they are present (if I use the same font in, say, gedit, it works fine). Makefile: test: test.c gcc -o test -ansi -pedantic -Wall test.c `sdl-config --cflags…
singpolyma
  • 10,999
  • 5
  • 47
  • 71
1 2
3
13 14