Skip to content

Commit

Permalink
Fixed bug 3679 - TTF_RenderUTF8_Blended_Wrapped ignores lineSpace
Browse files Browse the repository at this point in the history
Sylvain

font->height   = FT_CEIL(FT_MulFix(face->ascender - face->descender, scale));

Since the freetype definition in FT_FaceRec gives:

/*    height              :: This value is the vertical distance         */
/*                           between two consecutive baselines,          */
/*                           expressed in font units.  It is always      */
/*                           positive.  Only relevant for scalable       */
/*                           formats.                                    */
/*                                                                       */
/*                           If you want the global glyph height, use    */
/*                           `ascender - descender'.                     */
  • Loading branch information
slouken committed Nov 6, 2018
1 parent 5a74a0c commit 674dd20
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions SDL_ttf.c
Expand Up @@ -415,9 +415,9 @@ static int TTF_initFontMetrics(TTF_Font *font)

/* Get the scalable font metrics for this font */
FT_Fixed scale = face->size->metrics.y_scale;
font->ascent = FT_CEIL(FT_MulFix(face->ascender, scale));
font->descent = FT_CEIL(FT_MulFix(face->descender, scale));
font->height = font->ascent - font->descent + /* baseline */ 1;
font->ascent = FT_CEIL(FT_MulFix(face->ascender, scale));
font->descent = FT_CEIL(FT_MulFix(face->descender, scale));
font->height = FT_CEIL(FT_MulFix(face->ascender - face->descender, scale));
font->lineskip = FT_CEIL(FT_MulFix(face->height, scale));
font->underline_offset = FT_FLOOR(FT_MulFix(face->underline_position, scale));
font->underline_height = FT_FLOOR(FT_MulFix(face->underline_thickness, scale));
Expand Down Expand Up @@ -1723,9 +1723,6 @@ static SDL_bool CharacterIsDelimiter(char c, const char *delimiters)
return SDL_FALSE;
}

/* Don't define this until we have a release where we can change font rendering
#define TTF_USE_LINESKIP
*/
SDL_Surface *TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
const char *text, SDL_Color fg, Uint32 wrapLength)
{
Expand Down Expand Up @@ -1836,11 +1833,7 @@ SDL_Surface *TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
} while (tok < end);
}

#ifdef TTF_USE_LINESKIP
rowHeight = SDL_max(height, TTF_FontLineSkip(font));
#else
rowHeight = height;
#endif

/* Create the target surface */
textbuf = SDL_CreateRGBSurface(SDL_SWSURFACE,
Expand Down

0 comments on commit 674dd20

Please sign in to comment.