diff --git a/resources/image/little_pl.png b/resources/image/little_pl.png new file mode 100644 index 0000000..7f7df27 Binary files /dev/null and b/resources/image/little_pl.png differ diff --git a/resources/image/text_pl.png b/resources/image/text_pl.png new file mode 100644 index 0000000..4d6eec3 Binary files /dev/null and b/resources/image/text_pl.png differ diff --git a/src/blupi.cxx b/src/blupi.cxx index 61b6e3f..011c0be 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -833,7 +833,10 @@ DoInit (int argc, char * argv[], bool & exit) totalDim.y = DIMTEXTY * 8 * 3; iconDim.x = DIMTEXTX; iconDim.y = DIMTEXTY; - if (!g_pPixmap->Cache (CHTEXT, "image/text.png", totalDim, iconDim)) + std::string text_filename = "image/text.png"; + if (GetLocale() == "pl") + text_filename = "image/text_pl.png"; // TODO: Merge into one texture, or use TTF fonts instead? + if (!g_pPixmap->Cache (CHTEXT, text_filename, totalDim, iconDim)) { InitFail ("Cache text.png"); return EXIT_FAILURE; @@ -843,7 +846,10 @@ DoInit (int argc, char * argv[], bool & exit) totalDim.y = DIMLITTLEY * 8; iconDim.x = DIMLITTLEX; iconDim.y = DIMLITTLEY; - if (!g_pPixmap->Cache (CHLITTLE, "image/little.png", totalDim, iconDim)) + std::string little_filename = "image/little.png"; + if (GetLocale() == "pl") + little_filename = "image/little_pl.png"; // TODO: Merge into one texture, or use TTF fonts instead? + if (!g_pPixmap->Cache (CHLITTLE, little_filename, totalDim, iconDim)) { InitFail ("Cache little.png"); return EXIT_FAILURE; diff --git a/src/event.cxx b/src/event.cxx index 3ef1919..d6c5598 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -3702,6 +3702,31 @@ CEvent::SetLanguage (Language lang) SDL_SetWindowTitle (g_window, gettext ("Planet Blupi")); m_pSound->CacheAll (); + + Point totalDim, iconDim; + totalDim.x = DIMTEXTX * 16; + totalDim.y = DIMTEXTY * 8 * 3; + iconDim.x = DIMTEXTX; + iconDim.y = DIMTEXTY; + std::string text_filename = "image/text.png"; + if (GetLocale() == "pl") + text_filename = "image/text_pl.png"; + if (!m_pPixmap->Cache (CHTEXT, text_filename, totalDim, iconDim)) + { + printf ("Error (Cache text.png)"); + } + + totalDim.x = DIMLITTLEX * 16; + totalDim.y = DIMLITTLEY * 8; + iconDim.x = DIMLITTLEX; + iconDim.y = DIMLITTLEY; + std::string little_filename = "image/little.png"; + if (GetLocale() == "pl") + little_filename = "image/little_pl.png"; + if (!m_pPixmap->Cache (CHLITTLE, little_filename, totalDim, iconDim)) + { + printf ("Error (Cache little.png)"); + } } // Clic dans un bouton. diff --git a/src/text.cxx b/src/text.cxx index b98a7cc..6b1d1f4 100644 --- a/src/text.cxx +++ b/src/text.cxx @@ -22,13 +22,14 @@ #include #include "def.h" +#include "misc.h" #include "pixmap.h" #include "text.h" /** * \brief Return the character offset for the sprite. * - * \param[in] c - The character (incremented if 0xC3 UTF-8). + * \param[in] c - The character (incremented if 0xC3 or 0xC4 or 0xC5 UTF-8). * \returns the offset. */ static Sint32 @@ -43,13 +44,35 @@ GetOffset (const char *& c) 0xAE, 0xB4, 0xB9, 0xBB, 0xA4, 0xB6, 0xA7, // UTF-8 }; + static const unsigned char table_accents_pl[] = { + /* Polish */ + /* ń * ó ę * ć * * */ + 0x84, 0xFF, 0xB3, 0x99, 0xFF, 0x87, 0xFF, 0xFF, // UTF-8 + /* ź ż * * ą ł ś */ + 0xBA, 0xBC, 0xFF, 0xFF, 0x85, 0x82, 0x9B, // UTF-8 + }; + if (static_cast (*c) == 0xC3) c++; + if (static_cast (*c) == 0xC4) + c++; + if (static_cast (*c) == 0xC5) + c++; - for (unsigned int i = 0; i < countof (table_accents); ++i) + if(GetLocale() == "pl") { + for (unsigned int i = 0; i < countof (table_accents_pl); ++i) + { + if ((unsigned char) *c == table_accents_pl[i]) + return 15 + i; + } + } + else { - if ((unsigned char) *c == table_accents[i]) - return 15 + i; + for (unsigned int i = 0; i < countof (table_accents); ++i) + { + if ((unsigned char) *c == table_accents[i]) + return 15 + i; + } } if (*c < 0) return 1; // square