1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-29 21:56:54 +02:00

possibility to add fonts at end of the font chain

This commit is contained in:
Laserlicht 2025-02-15 19:52:59 +01:00
parent e9dc9f81b8
commit 091477aebc
3 changed files with 7 additions and 4 deletions

@ -74,9 +74,12 @@ bool FontChain::bitmapFontsPrioritized(const std::string & bitmapFontName) const
return true; // else - use original bitmap fonts 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) void FontChain::addBitmapFont(const std::string & bitmapFilename)

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

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