Hot answers tagged

6

You can acheive what you want by drawing the text with an outline in one color, and then drawing it without outline on top of that, in another color. Here's an example of white text with a black outline from the libsdl forum: #define OUTLINE_SIZE 2 /* load font and its outline */ font = TTF_OpenFont(font_path, font_size); font_outline = TTF_OpenFont(...


3

The way outline fonts (such as ttf) work is by defining a set of curves by vector graphics (quadratic Bézier in the case of ttf). What is inside or outside? At the moment of rendering the target area has a set of pixel where the character will be drawn. The following is a simplification of the algorithm to do so: Go row by row: Start by considering we are ...


2

The \n is supposed to work in the _Wrapped() function calls. So just replace the [ character with a \n character.


2

You're probably running into surface/texture size issues, since you're loading the font in a massive size (900). I'd suggest using a much smaller point size, and that should look just as good as you don't necessarily need to downscale it at all. I render fonts with sizes around 30 for smaller text, and around 50 for larger menu text.


2

In many game engines you would create a texture map for your fonts, rendering the TTF font into a character sheet that is used in the game itself, but it is quite possible to convert the TTF bezier curves into geometry that can be rendered directly on the GPU in a very efficient way. In the end, the performance difference is minimal and unless you are ...


1

There are a few ways to do this. You could render a texture with SDL_TTF that contains all the characters you want to be able to display, and then use that texture as a spritesheet, and pick characters from there using source rectangles, rendering them next to each other. This is a bit more work since you need to calculate correct character offsets etc. ...


1

Using printf("%s\n", TTF_GetError()); i got the answer that the font hadn't been loaded correctly, so you provided the correct answer, nothing with the code but just the entered filepath on my part.


1

I updated the LibGDX wiki to specifically address this issue. The old example code used there was just too confusing for anyone to take a quick glance at and figure out what they were doing. Take a look when you get a chance. Anyway, you're loading myFont62.ttf which is a string identifier of the resource fonts/zrnic.ttf. Instead of using a different name, ...


1

The colour is set to be the same as the font, so it can't be used as you'd like it to be. I'd suggest having a look at bitmap fonts, there's a tutorial here. Alternatively, if you'd like to continue using SDL_TTF, you could look into generating a glyph atlas. I personally don't have much experience with this but it is explained in another question here.


1

If your test desktop filesystem is running on Windows NTFS and the Android device filesystem is on Android native, the difference is in the filesystem drivers. The Windows filesystem drivers are not case sensitive but Android uses Linux which is case sensitive. Make sure your capitalization is correct on the file. Additionally I noticed you were using ...


Only top voted, non community-wiki answers of a minimum length are eligible