Răsfoiți Sursa

possibility to add fonts at end of the font chain

Laserlicht 8 luni în urmă
părinte
comite
091477aebc

+ 5 - 2
client/renderSDL/FontChain.cpp

@@ -74,9 +74,12 @@ bool FontChain::bitmapFontsPrioritized(const std::string & bitmapFontName) const
 	return true; // else - use original bitmap fonts
 }
 
-void FontChain::addTrueTypeFont(const JsonNode & trueTypeConfig)
+void FontChain::addTrueTypeFont(const JsonNode & trueTypeConfig, bool begin)
 {
-	chain.insert(chain.begin(), std::make_unique<CTrueTypeFont>(trueTypeConfig));
+	if(begin)
+		chain.insert(chain.begin(), std::make_unique<CTrueTypeFont>(trueTypeConfig));
+	else
+		chain.push_back(std::make_unique<CTrueTypeFont>(trueTypeConfig));
 }
 
 void FontChain::addBitmapFont(const std::string & bitmapFilename)

+ 1 - 1
client/renderSDL/FontChain.h

@@ -33,7 +33,7 @@ class FontChain final : public IFont
 public:
 	FontChain() = default;
 
-	void addTrueTypeFont(const JsonNode & trueTypeConfig);
+	void addTrueTypeFont(const JsonNode & trueTypeConfig, bool begin);
 	void addBitmapFont(const std::string & bitmapFilename);
 
 	size_t getLineHeightScaled() const override;

+ 1 - 1
client/renderSDL/RenderHandler.cpp

@@ -494,7 +494,7 @@ std::shared_ptr<const IFont> RenderHandler::loadFont(EFonts font)
 
 		bitmapPath = bmpConf[index].String();
 		if (!ttfConf[bitmapPath].isNull())
-			loadedFont->addTrueTypeFont(ttfConf[bitmapPath]);
+			loadedFont->addTrueTypeFont(ttfConf[bitmapPath], !config["lowPriority"].Bool());
 	}
 	loadedFont->addBitmapFont(bitmapPath);