Skip to content

Commit 3413365

Browse files
committed
Account for outline in text engine layout
Fixes #518
1 parent d1e85b2 commit 3413365

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/SDL_ttf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,8 @@ static bool Render_Line_TextEngine(TTF_Font *font, TTF_Direction direction, int
15311531
op->copy.glyph_index = idx;
15321532
op->copy.src.x = glyph_x;
15331533
op->copy.src.y = glyph_y;
1534-
op->copy.src.w = glyph_width;
1535-
op->copy.src.h = glyph_rows;
1534+
op->copy.src.w = glyph_width + 2 * font->outline;
1535+
op->copy.src.h = glyph_rows + 2 * font->outline;
15361536
op->copy.dst.x = x;
15371537
op->copy.dst.y = y;
15381538
op->copy.dst.w = op->copy.src.w;
@@ -1545,7 +1545,7 @@ static bool Render_Line_TextEngine(TTF_Font *font, TTF_Direction direction, int
15451545
}
15461546
} else {
15471547
// Use the distance to the next glyph as our bounds width
1548-
glyph_width = FT_FLOOR(pos->x_advance);
1548+
glyph_width = FT_FLOOR(pos->x_advance) + 2 * font->outline;
15491549
}
15501550

15511551
bounds.x = x;

0 commit comments

Comments
 (0)