1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- playing a bit with ttf fonts: bugfix + shadow rendering

This commit is contained in:
Ivan Savenko 2013-01-29 22:43:39 +00:00
parent 5194569053
commit a82601db72
2 changed files with 14 additions and 8 deletions

View File

@ -256,13 +256,19 @@ size_t CTrueTypeFont::getStringWidth(const std::string & data) const
void CTrueTypeFont::renderText(SDL_Surface * surface, const std::string & data, const SDL_Color & color, const Point & pos) const
{
if (color.r != 0 && color.g != 0 && color.b != 0) // not black - add shadow
{
SDL_Color black = { 0, 0, 0, SDL_ALPHA_OPAQUE};
renderText(surface, data, black, Point(pos.x + 1, pos.y + 1));
}
if (!data.empty())
{
SDL_Surface * rendered;
if (blended)
rendered = TTF_RenderText_Solid(font.get(), data.c_str(), color);
else
rendered = TTF_RenderText_Blended(font.get(), data.c_str(), color);
else
rendered = TTF_RenderText_Solid(font.get(), data.c_str(), color);
assert(rendered);

View File

@ -24,14 +24,14 @@
// "blend" - if set to true, font will be antialiased
"trueType":
{
//"BIGFONT" : { "file" : "TimesNewRoman.ttf", "size" : 20, "style" : ["bold"], "blend" : true},
//"BIGFONT" : { "file" : "LiberationSerif-Bold.ttf", "size" : 22, "blend" : true},
//"CALLI10R" : { "file" : "Georgia.ttf", "size" : 10},
//"CREDITS" : { "file" : "TimesNewRoman.ttf", "size" : 13, "blend" : true},
//"CREDITS" : { "file" : "LiberationSerif-Bold.ttf", "size" : 28},
//"HISCORE" : { "file" : "Georgia.ttf", "size" : 13},
//"MEDFONT" : { "file" : "TimesNewRoman.ttf", "size" : 16, "blend" : true},
//"SMALFONT" : { "file" : "Georgia.ttf", "size" : 13},
//"TIMES08R" : { "file" : "TimesNewRoman.ttf", "size" : 8, "blend" : true},
//"TINY" : { "file" : "Georgia.ttf", "size" : 10},
//"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}
}
}