Fixed bug causing the newline character to misalign text if "TEXT_ALIGN_CENTER" is used with multi-line strings.

pull/85/head
Wojciech Kaczmarski 2022-06-14 15:56:13 +02:00 zatwierdzone przez Silvano Seva
rodzic cdbbaa0ef1
commit a5b7658878
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -439,7 +439,15 @@ point_t gfx_printBuffer(point_t start, fontSize_t size, textAlign_t alignment,
// Handle newline and carriage return
if (c == '\n')
{
start.x = reset_x;
if(alignment!=TEXT_ALIGN_CENTER)
{
start.x = reset_x;
}
else
{
line_size = get_line_size(f, &buf[i+1], len-(i+1));
start.x = reset_x = get_reset_x(alignment, line_size, start.x);
}
start.y += f.yAdvance;
continue;
}