Skip to content

Commit

Permalink
Wrapped mode: honor wrapLength even if you have one line which hasn't…
Browse files Browse the repository at this point in the history
… been cut.

As it would be if this line was part of multilines set.
  • Loading branch information
1bsyl committed Dec 18, 2018
1 parent 0c87e92 commit f3a3080
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SDL_ttf.c
Expand Up @@ -1871,9 +1871,14 @@ SDL_Surface *TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
lineskip = TTF_FontLineSkip(font);
rowHeight = SDL_max(height, lineskip);

width = (numLines > 1) ? wrapLength : width;

/* Don't go above wrapLength if you have only 1 line which hasn't been cut */
width = SDL_min((int)wrapLength, width);

/* Create the target surface */
textbuf = SDL_CreateRGBSurface(SDL_SWSURFACE,
(numLines > 1) ? wrapLength : width,
width,
rowHeight + lineskip * (numLines - 1),
32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
if (textbuf == NULL) {
Expand Down

0 comments on commit f3a3080

Please sign in to comment.