added support for text with ñ and ç

This commit is contained in:
2021-04-28 21:04:01 +02:00
parent 176d0d4f90
commit 5847c79ffb
4 changed files with 21 additions and 8 deletions

View File

@@ -34,7 +34,7 @@ void Text::init(Uint8 type, Uint8 size)
const std::string text = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ{\\[]]^_`abcdefghijklmnopqrstuvwxyz";
// Inicializa a cero el vector con las coordenadas
for (int i = 0; i < 255; i++)
for (int i = 0; i < 128; i++)
{
mOffset[i].x = 0;
mOffset[i].y = 0;
@@ -50,6 +50,15 @@ void Text::init(Uint8 type, Uint8 size)
mOffset[int(text[i])].w = size;
}
// Establece las coordenadas de forma manual para la ñ y la ç
mOffset[int('^')].x = mOffset[int('z')].x + size;
mOffset[int('^')].y = mOffset[int('z')].y;
mOffset[int('^')].w = size;
mOffset[int('~')].x = mOffset[int('z')].x + size * 2;
mOffset[int('~')].y = mOffset[int('z')].y;
mOffset[int('~')].w = size;
// Establece el ancho de cada caracter
if (type == TEXT_VARIABLE)
{
@@ -102,6 +111,10 @@ void Text::init(Uint8 type, Uint8 size)
mOffset[int('Y')].w = 8;
mOffset[int('Z')].w = 7;
mOffset[int('^')].w = 7;
mOffset[int('~')].w = 7;
mOffset[int('a')].w = 7;
mOffset[int('b')].w = 7;
mOffset[int('c')].w = 6;