mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Integrated Noto fonts into vcmi
This commit is contained in:
parent
5502dcaea4
commit
97e24ff126
BIN
Mods/vcmi/Data/NotoSans-Medium.ttf
Normal file
BIN
Mods/vcmi/Data/NotoSans-Medium.ttf
Normal file
Binary file not shown.
BIN
Mods/vcmi/Data/NotoSerif-Black.ttf
Normal file
BIN
Mods/vcmi/Data/NotoSerif-Black.ttf
Normal file
Binary file not shown.
BIN
Mods/vcmi/Data/NotoSerif-Bold.ttf
Normal file
BIN
Mods/vcmi/Data/NotoSerif-Bold.ttf
Normal file
Binary file not shown.
BIN
Mods/vcmi/Data/NotoSerif-Medium.ttf
Normal file
BIN
Mods/vcmi/Data/NotoSerif-Medium.ttf
Normal file
Binary file not shown.
@ -285,7 +285,7 @@ EFonts InterfaceObjectConfigurable::readFont(const JsonNode & config) const
|
||||
return EFonts::FONT_CALLI;
|
||||
}
|
||||
logGlobal->debug("Unknown font attribute");
|
||||
return EFonts::FONT_TIMES;
|
||||
return EFonts::FONT_MEDIUM;
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> InterfaceObjectConfigurable::readHintText(const JsonNode & config) const
|
||||
|
@ -62,12 +62,14 @@ int CTrueTypeFont::getFontStyle(const JsonNode &config) const
|
||||
CTrueTypeFont::CTrueTypeFont(const JsonNode & fontConfig):
|
||||
data(loadData(fontConfig)),
|
||||
font(loadFont(fontConfig), TTF_CloseFont),
|
||||
dropShadow(fontConfig["blend"].Bool()),
|
||||
blended(fontConfig["blend"].Bool())
|
||||
dropShadow(!fontConfig["noShadow"].Bool()),
|
||||
outline(fontConfig["outline"].Bool()),
|
||||
blended(true)
|
||||
{
|
||||
assert(font);
|
||||
|
||||
TTF_SetFontStyle(font.get(), getFontStyle(fontConfig));
|
||||
TTF_SetFontHinting(font.get(),TTF_HINTING_MONO);
|
||||
|
||||
std::string fallbackName = fontConfig["fallback"].String();
|
||||
|
||||
@ -111,8 +113,14 @@ void CTrueTypeFont::renderText(SDL_Surface * surface, const std::string & data,
|
||||
return;
|
||||
}
|
||||
|
||||
if (dropShadow && color.r != 0 && color.g != 0 && color.b != 0) // not black - add shadow
|
||||
renderText(surface, data, Colors::BLACK, pos + Point(1,1) * getScalingFactor());
|
||||
if (color.r != 0 && color.g != 0 && color.b != 0) // not black - add shadow
|
||||
{
|
||||
if (outline)
|
||||
renderText(surface, data, Colors::BLACK, pos - Point(1,1) * getScalingFactor());
|
||||
|
||||
if (dropShadow || outline)
|
||||
renderText(surface, data, Colors::BLACK, pos + Point(1,1) * getScalingFactor());
|
||||
}
|
||||
|
||||
if (!data.empty())
|
||||
{
|
||||
|
@ -26,6 +26,7 @@ class CTrueTypeFont final : public IFont
|
||||
|
||||
const std::unique_ptr<TTF_Font, void (*)(TTF_Font*)> font;
|
||||
const bool blended;
|
||||
const bool outline;
|
||||
const bool dropShadow;
|
||||
|
||||
std::pair<std::unique_ptr<ui8[]>, ui64> loadData(const JsonNode & config);
|
||||
|
@ -5,12 +5,12 @@
|
||||
"bitmap" :
|
||||
[
|
||||
"BIGFONT", // Mostly used for window titles
|
||||
"CALLI10R", // Unused in VCMI
|
||||
"CREDITS", // Used for credits menu
|
||||
"HISCORE", // Unused in VCMI
|
||||
"CALLI10R", // Only in World View menu
|
||||
"CREDITS", // Only in Credits menu
|
||||
"HISCORE", // Only in High Scores menu
|
||||
"MEDFONT", // Some titles
|
||||
"SMALFONT", // Most of the messages
|
||||
"TIMES08R", // Used to display amounts on creature card
|
||||
"TIMES08R", // Unused in VCMI
|
||||
"TINY", // Some text
|
||||
"VERD10B" // Unused in VCMI
|
||||
],
|
||||
@ -25,17 +25,18 @@
|
||||
// b) list of scaling factors for each scaling mode, e.g. [ 10, 16, 22, 26]. In this case game will select point size according to xBRZ scaling factor
|
||||
// so unscaled mode will use 10px, xbrz2 will use 16px, and xbrz3 will use 22
|
||||
// "style" - italic and\or bold, indicates font style
|
||||
// "blend" - if set to true, font will be antialiased
|
||||
// "outline" - if set, black shadow will be generated around entire text (instead of only bottom-right side)
|
||||
// "noShadow" - if set, this font will not drop any shadow
|
||||
"trueType":
|
||||
{
|
||||
//"BIGFONT" : { "file" : "LiberationSerif-Bold.ttf", "size" : 22, "blend" : true},
|
||||
//"CALLI10R" : { "file" : "Georgia.ttf", "size" : 10},
|
||||
//"CREDITS" : { "file" : "LiberationSerif-Bold.ttf", "size" : 28},
|
||||
//"HISCORE" : { "file" : "Georgia.ttf", "size" : 13},
|
||||
//"MEDFONT" : { "file" : "LiberationSerif-Bold.ttf", "size" : 16}, // breaks messages (from map events)
|
||||
//"SMALFONT" : { "file" : "LiberationSerif-Regular.ttf", "size" : 13, "blend" : true},
|
||||
//"TIMES08R" : { "file" : "LiberationSerif-Regular.ttf", "size" : 11, "blend" : true},
|
||||
//"TINY" : { "file" : "LiberationSerif-Regular.ttf", "size" : 11, "blend" : true},
|
||||
//"VERD10B" : { "file" : "Georgia.ttf", "size" : 13}
|
||||
"BIGFONT" : { "file" : "NotoSerif-Bold.ttf", "size" : [ 19, 39, 58, 78] },
|
||||
"CALLI10R" : { "file" : "NotoSerif-Bold.ttf", "size" : [ 12, 24, 36, 48] }, // TODO: find better matching font? This is likely non-free 'Callisto MT' font
|
||||
"CREDITS" : { "file" : "NotoSerif-Black.ttf", "size" : [ 22, 44, 66, 88], "outline" : true },
|
||||
"HISCORE" : { "file" : "NotoSerif-Black.ttf", "size" : [ 18, 36, 54, 72], "outline" : true },
|
||||
"MEDFONT" : { "file" : "NotoSerif-Bold.ttf", "size" : [ 15, 31, 46, 62] },
|
||||
"SMALFONT" : { "file" : "NotoSerif-Medium.ttf", "size" : [ 12, 24, 36, 48] },
|
||||
"TIMES08R" : { "file" : "NotoSerif-Medium.ttf", "size" : [ 8, 16, 24, 32] },
|
||||
"TINY" : { "file" : "NotoSans-Medium.ttf", "size" : [ 9, 19, 28, 38], "noShadow" : true }, // The only H3 font without shadow
|
||||
"VERD10B" : { "file" : "NotoSans-Medium.ttf", "size" : [ 13, 26, 39, 52] }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user