1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +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

View File

@ -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)

View File

@ -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;

View File

@ -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);