Browse Source

Reduce TTF line spacing to roughly match Diablo

pull/314/head
Gleb Mazovetskiy 7 years ago committed by Anders Jenbo
parent
commit
d7bec68fb2
  1. 4
      SourceX/DiabloUI/ttf_render_wrapped.cpp

4
SourceX/DiabloUI/ttf_render_wrapped.cpp

@ -136,6 +136,8 @@ SDL_Surface *RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, SDL_Colo
SDL_SetColorKey(textbuf, SDL_TRUE, 0); SDL_SetColorKey(textbuf, SDL_TRUE, 0);
#endif #endif
// Reduced space between lines to roughly match Diablo.
const int lineskip = 0.7 * TTF_FontLineSkip(font);
SDL_Rect dest = { 0, 0, 0, 0 }; SDL_Rect dest = { 0, 0, 0, 0 };
for (std::size_t line = 0; line < numLines; line++) { for (std::size_t line = 0; line < numLines; line++) {
text = strLines[line]; text = strLines[line];
@ -155,7 +157,7 @@ SDL_Surface *RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, SDL_Colo
break; break;
} }
SDL_BlitSurface(tmp, nullptr, textbuf, &dest); SDL_BlitSurface(tmp, nullptr, textbuf, &dest);
dest.y += tmp->h; dest.y += lineskip;
SDL_FreeSurface(tmp); SDL_FreeSurface(tmp);
} }
SDL_free(strLines); SDL_free(strLines);

Loading…
Cancel
Save