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:
parent
e9dc9f81b8
commit
091477aebc
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user