Browse Source

fixes #1482, add one pixel spacing for Chinese fonts

Ivan Savenko 12 years ago
parent
commit
eb6ff6b114
2 changed files with 9 additions and 6 deletions
  1. 3 3
      client/gui/Fonts.cpp
  2. 6 3
      launcher/modManager/cmodmanager.cpp

+ 3 - 3
client/gui/Fonts.cpp

@@ -340,7 +340,7 @@ void CBitmapHanFont::renderCharacter(SDL_Surface * surface, int characterIndex,
 				colorPutter(dstPixel, color.r, color.g, color.b);
 		}
 	}
-	posX += size;
+	posX += size + 1;
 }
 
 void CBitmapHanFont::renderText(SDL_Surface * surface, const std::string & data, const SDL_Color & color, const Point & pos) const
@@ -373,12 +373,12 @@ CBitmapHanFont::CBitmapHanFont(const JsonNode &config):
 
 size_t CBitmapHanFont::getLineHeight() const
 {
-	return size;
+	return size + 1;
 }
 
 size_t CBitmapHanFont::getGlyphWidth(const char * data) const
 {
-	return size;
+	return size + 1;
 }
 
 size_t CBitmapHanFont::getCharacterSize(char data) const

+ 6 - 3
launcher/modManager/cmodmanager.cpp

@@ -64,9 +64,12 @@ void CModManager::loadMods()
 	for (auto modname : installedMods)
 	{
 		ResourceID resID("Mods/" + modname + "/mod.json");
-		std::string name = *CResourceHandler::get()->getResourceName(resID);
-		auto mod = JsonUtils::JsonFromFile(QString::fromUtf8(name.c_str()));
-		localMods.insert(QString::fromUtf8(modname.c_str()).toLower(), mod);
+		if (CResourceHandler::get()->existsResource(resID))
+		{
+			std::string name = *CResourceHandler::get()->getResourceName(resID);
+			auto mod = JsonUtils::JsonFromFile(QString::fromUtf8(name.c_str()));
+			localMods.insert(QString::fromUtf8(modname.c_str()).toLower(), mod);
+		}
 	}
 	modList->setLocalModList(localMods);
 }