diff --git a/.gitignore b/.gitignore index 637d42a5..ef197501 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ CMakeLists.txt.user* *.log *.bak *.swp +*.pic .lvimrc .clang_complete config.otml @@ -33,4 +34,4 @@ config.otml otclient.map otclient.layout LOCALTODO -tags \ No newline at end of file +tags diff --git a/modules/client_locales/locales/en.lua b/modules/client_locales/locales/en.lua index b87eb64a..155c24f7 100644 --- a/modules/client_locales/locales/en.lua +++ b/modules/client_locales/locales/en.lua @@ -1,5 +1,6 @@ locale = { name = "en", + charset = "cp1252", languageName = "English", -- translations are not needed because everything is already in english diff --git a/modules/client_locales/locales/es.lua b/modules/client_locales/locales/es.lua index b83e1ccb..69a9421b 100644 --- a/modules/client_locales/locales/es.lua +++ b/modules/client_locales/locales/es.lua @@ -2,6 +2,7 @@ locale = { name = "es", + charset = "cp1252", languageName = "Español", translation = { diff --git a/modules/client_locales/locales/pl.lua b/modules/client_locales/locales/pl.lua index 13408a39..0da6be3b 100644 --- a/modules/client_locales/locales/pl.lua +++ b/modules/client_locales/locales/pl.lua @@ -5,6 +5,7 @@ locale = { name = "pl", + charset = "cp1250", languageName = "Polski", translation = { diff --git a/modules/client_locales/locales/pt.lua b/modules/client_locales/locales/pt.lua index d617b54c..2c2d3bc5 100644 --- a/modules/client_locales/locales/pt.lua +++ b/modules/client_locales/locales/pt.lua @@ -1,5 +1,6 @@ locale = { name = "pt", + charset = "cp1252", languageName = "Português", -- As traduções devem vir sempre em ordem alfabética. diff --git a/modules/client_locales/locales/sv.lua b/modules/client_locales/locales/sv.lua index 1035b362..f417e6d3 100644 --- a/modules/client_locales/locales/sv.lua +++ b/modules/client_locales/locales/sv.lua @@ -2,6 +2,7 @@ locale = { name = "sv", + charset = "cp1252", languageName = "Svenska", translation = { diff --git a/modules/client_skins/skins/default/fonts/terminus-14px-bold.otfont b/modules/client_skins/skins/default/fonts/terminus-14px-bold.otfont index 2e1d314a..50aaab9e 100644 --- a/modules/client_skins/skins/default/fonts/terminus-14px-bold.otfont +++ b/modules/client_skins/skins/default/fonts/terminus-14px-bold.otfont @@ -1,8 +1,7 @@ Font name: terminus-14px-bold + texture: terminus-14px-bold.png height: 16 y-offset: 2 - texture: terminus-14px-bold.png glyph-size: 16 16 fixed-glyph-width: 8 - diff --git a/modules/client_skins/skins/default/fonts/terminus-14px-bold.png b/modules/client_skins/skins/default/fonts/terminus-14px-bold.png index 8992fcac..99962a53 100644 Binary files a/modules/client_skins/skins/default/fonts/terminus-14px-bold.png and b/modules/client_skins/skins/default/fonts/terminus-14px-bold.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-antialised.otfont b/modules/client_skins/skins/default/fonts/verdana-11px-antialised.otfont index 87bc065e..70e00556 100644 --- a/modules/client_skins/skins/default/fonts/verdana-11px-antialised.otfont +++ b/modules/client_skins/skins/default/fonts/verdana-11px-antialised.otfont @@ -1,8 +1,6 @@ Font name: verdana-11px-antialised - texture: verdana-11px-antialised.png + texture: verdana-11px-antialised_cp1252.png height: 14 glyph-size: 16 16 - - glyph-widths: - 32: 4 + space-width: 4 diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-antialised.png b/modules/client_skins/skins/default/fonts/verdana-11px-antialised.png deleted file mode 100644 index e3a14d5f..00000000 Binary files a/modules/client_skins/skins/default/fonts/verdana-11px-antialised.png and /dev/null differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1250.png b/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1250.png new file mode 100644 index 00000000..ba9e6cbd Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1250.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1252.png b/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1252.png new file mode 100644 index 00000000..c01e2184 Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-antialised_cp1252.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.otfont b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.otfont index a9dfb31b..1c22e827 100644 --- a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.otfont +++ b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.otfont @@ -1,8 +1,6 @@ Font name: verdana-11px-monochrome - texture: verdana-11px-monochrome.png + texture: verdana-11px-monochrome_cp1252.png height: 14 glyph-size: 16 16 - - glyph-widths: - 32: 2 + space-width: 4 diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.png b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.png deleted file mode 100644 index f455efa2..00000000 Binary files a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome.png and /dev/null differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1250.png b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1250.png new file mode 100644 index 00000000..11002ef7 Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1250.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1252.png b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1252.png new file mode 100644 index 00000000..d053ca5b Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-monochrome_cp1252.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-rounded.otfont b/modules/client_skins/skins/default/fonts/verdana-11px-rounded.otfont index 711b2f33..ad29af94 100644 --- a/modules/client_skins/skins/default/fonts/verdana-11px-rounded.otfont +++ b/modules/client_skins/skins/default/fonts/verdana-11px-rounded.otfont @@ -1,232 +1,8 @@ Font name: verdana-11px-rounded - texture: verdana-11px-rounded.png - height: 14 + texture: verdana-11px-rounded_cp1252.png + height: 16 glyph-size: 16 16 - spacing: -1 0 - - glyph-widths: - 32: 4 - 33: 4 - 34: 7 - 35: 9 - 36: 8 - 37: 10 - 38: 10 - 39: 4 - 40: 6 - 41: 6 - 42: 8 - 43: 9 - 44: 4 - 45: 7 - 46: 4 - 47: 8 - 48: 8 - 49: 6 - 50: 8 - 51: 8 - 52: 8 - 53: 8 - 54: 8 - 55: 8 - 56: 8 - 57: 8 - 58: 5 - 59: 5 - 60: 10 - 61: 10 - 62: 10 - 63: 7 - 64: 10 - 65: 9 - 66: 8 - 67: 8 - 68: 9 - 69: 8 - 70: 8 - 71: 9 - 72: 9 - 73: 6 - 74: 7 - 75: 8 - 76: 8 - 77: 10 - 78: 9 - 79: 9 - 80: 8 - 81: 9 - 82: 9 - 83: 8 - 84: 10 - 85: 9 - 86: 8 - 87: 10 - 88: 8 - 89: 8 - 90: 8 - 91: 6 - 92: 8 - 93: 6 - 94: 11 - 95: 9 - 96: 7 - 97: 8 - 98: 8 - 99: 7 - 100: 8 - 101: 8 - 102: 7 - 103: 8 - 104: 8 - 105: 4 - 106: 6 - 107: 8 - 108: 4 - 109: 10 - 110: 8 - 111: 8 - 112: 8 - 113: 8 - 114: 7 - 115: 7 - 116: 7 - 117: 8 - 118: 8 - 119: 10 - 120: 8 - 121: 8 - 122: 7 - 123: 8 - 124: 5 - 125: 8 - 126: 9 - 127: 13 - 128: 8 - 129: 13 - 130: 4 - 131: 8 - 132: 6 - 133: 13 - 134: 8 - 135: 8 - 136: 7 - 137: 20 - 138: 8 - 139: 6 - 140: 13 - 141: 13 - 142: 7 - 143: 13 - 144: 13 - 145: 4 - 146: 4 - 147: 6 - 148: 6 - 149: 8 - 150: 8 - 151: 12 - 152: 7 - 153: 11 - 154: 7 - 155: 6 - 156: 13 - 157: 13 - 158: 7 - 159: 9 - 160: 4 - 161: 5 - 162: 8 - 163: 8 - 164: 8 - 165: 8 - 166: 7 - 167: 8 - 168: 7 - 169: 12 - 170: 7 - 171: 9 - 172: 11 - 173: 6 - 174: 12 - 175: 8 - 176: 7 - 177: 11 - 178: 7 - 179: 7 - 180: 7 - 181: 8 - 182: 8 - 183: 5 - 184: 7 - 185: 7 - 186: 7 - 187: 9 - 188: 15 - 189: 15 - 190: 15 - 191: 7 - 192: 10 - 193: 10 - 194: 10 - 195: 10 - 196: 10 - 197: 10 - 198: 13 - 199: 8 - 200: 7 - 201: 7 - 202: 7 - 203: 7 - 204: 5 - 205: 5 - 206: 5 - 207: 5 - 208: 10 - 209: 8 - 210: 9 - 211: 9 - 212: 9 - 213: 9 - 214: 9 - 215: 11 - 216: 9 - 217: 8 - 218: 9 - 219: 8 - 220: 8 - 221: 9 - 222: 9 - 223: 8 - 224: 8 - 225: 8 - 226: 8 - 227: 8 - 228: 8 - 229: 8 - 230: 12 - 231: 6 - 232: 8 - 233: 8 - 234: 8 - 235: 8 - 236: 5 - 237: 5 - 238: 3 - 239: 3 - 240: 8 - 241: 8 - 242: 8 - 243: 8 - 244: 8 - 245: 8 - 246: 8 - 247: 11 - 248: 8 - 249: 8 - 250: 8 - 251: 8 - 252: 8 - 253: 8 - 254: 8 - 255: 8 + y-offset: -2 + spacing: -1 -3 + space-width: 4 diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-rounded.png b/modules/client_skins/skins/default/fonts/verdana-11px-rounded.png deleted file mode 100644 index 31a11f51..00000000 Binary files a/modules/client_skins/skins/default/fonts/verdana-11px-rounded.png and /dev/null differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1250.png b/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1250.png new file mode 100644 index 00000000..bcf46383 Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1250.png differ diff --git a/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1252.png b/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1252.png new file mode 100644 index 00000000..0ff03226 Binary files /dev/null and b/modules/client_skins/skins/default/fonts/verdana-11px-rounded_cp1252.png differ diff --git a/src/framework/core/application.cpp b/src/framework/core/application.cpp index b7c99996..5c27cd97 100644 --- a/src/framework/core/application.cpp +++ b/src/framework/core/application.cpp @@ -53,6 +53,7 @@ Application::Application() m_appName = "application"; m_appCompactName = "app"; m_appVersion = "none"; + m_charset = "cp1252"; m_stopping = false; } diff --git a/src/framework/core/application.h b/src/framework/core/application.h index 0e96953e..9b48e8e4 100644 --- a/src/framework/core/application.h +++ b/src/framework/core/application.h @@ -52,6 +52,7 @@ public: const std::string& getCompactName() { return m_appCompactName; } const std::string& getVersion() { return m_appVersion; } + std::string getCharset() { return m_charset; } std::string getBuildCompiler() { return BUILD_COMPILER; } std::string getBuildDate(); std::string getBuildRevision() { return BUILD_REVISION; } @@ -64,6 +65,7 @@ public: protected: void registerLuaFunctions(); + std::string m_charset; std::string m_appName; std::string m_appCompactName; std::string m_appVersion; diff --git a/src/framework/graphics/bitmapfont.cpp b/src/framework/graphics/bitmapfont.cpp index 39e5056a..bed56130 100644 --- a/src/framework/graphics/bitmapfont.cpp +++ b/src/framework/graphics/bitmapfont.cpp @@ -36,6 +36,7 @@ void BitmapFont::load(const OTMLNodePtr& fontNode) m_yOffset = fontNode->valueAt("y-offset", 0); m_firstGlyph = fontNode->valueAt("first-glyph", 32); m_glyphSpacing = fontNode->valueAt("spacing", Size(0,0)); + int spaceWidth = fontNode->valueAt("space-width", glyphSize.width()); // load font texture m_texture = g_textures.getTexture(textureFile); @@ -47,14 +48,21 @@ void BitmapFont::load(const OTMLNodePtr& fontNode) calculateGlyphsWidthsAutomatically(Image::load(textureFile), glyphSize); } + // 32 and 160 are spaces ( ) + m_glyphsSize[32].setWidth(spaceWidth); + m_glyphsSize[160].setWidth(spaceWidth); + // new line actually has a size that will be useful in multiline algorithm m_glyphsSize[(uchar)'\n'] = Size(1, m_glyphHeight); // read custom widths + /* if(OTMLNodePtr node = fontNode->get("glyph-widths")) { for(const OTMLNodePtr& child : node->children()) m_glyphsSize[stdext::safe_cast(child->tag())].setWidth(child->value()); } + */ + // calculate glyphs texture coords int numHorizontalGlyphs = m_texture->getSize().width() / glyphSize.width(); @@ -268,12 +276,8 @@ void BitmapFont::calculateGlyphsWidthsAutomatically(const ImagePtr& image, const if(texturePixels[(y * image->getSize().width() * 4) + (x*4) + 3] != 0) filledPixels++; } - if(filledPixels > 0) { + if(filledPixels > 0) width = x - glyphCoords.left() + 1; - width += m_glyphSpacing.width(); - if(m_glyphHeight >= 16 && filledPixels >= m_glyphHeight/3) - width += 1; - } } // store glyph size m_glyphsSize[glyph].resize(width, m_glyphHeight);