Skip to content

Commit

Permalink
Account for outline in text engine layout
Browse files Browse the repository at this point in the history
Fixes #518
  • Loading branch information
slouken committed Feb 27, 2025
1 parent d1e85b2 commit 3413365
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,8 +1531,8 @@ static bool Render_Line_TextEngine(TTF_Font *font, TTF_Direction direction, int
op->copy.glyph_index = idx;
op->copy.src.x = glyph_x;
op->copy.src.y = glyph_y;
op->copy.src.w = glyph_width;
op->copy.src.h = glyph_rows;
op->copy.src.w = glyph_width + 2 * font->outline;
op->copy.src.h = glyph_rows + 2 * font->outline;
op->copy.dst.x = x;
op->copy.dst.y = y;
op->copy.dst.w = op->copy.src.w;
Expand All @@ -1545,7 +1545,7 @@ static bool Render_Line_TextEngine(TTF_Font *font, TTF_Direction direction, int
}
} else {
// Use the distance to the next glyph as our bounds width
glyph_width = FT_FLOOR(pos->x_advance);
glyph_width = FT_FLOOR(pos->x_advance) + 2 * font->outline;
}

bounds.x = x;
Expand Down

0 comments on commit 3413365

Please sign in to comment.