mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
Simulate font hinting when using TrueType fonts for better legibility.
This commit is contained in:
committed by
Marijn van der Werf
parent
3357d32ec4
commit
ea034e85fa
@@ -798,7 +798,19 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
||||
if (info->flags & TEXT_DRAW_FLAG_INSET) {
|
||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
||||
}
|
||||
*dst = colour;
|
||||
|
||||
if (*src > 180)
|
||||
{
|
||||
// Centre of the glyph: use full colour.
|
||||
*dst = colour;
|
||||
}
|
||||
else if (*src > 70)
|
||||
{
|
||||
// Simulate font hinting by shading the background colour instead.
|
||||
// uint8 hinting = floor(*src / 12);
|
||||
// *dst = *dst - (*dst % 12) + hinting;
|
||||
*dst = *dst + 2;
|
||||
}
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
|
||||
@@ -276,7 +276,7 @@ static bool ttf_get_size(TTF_Font * font, const utf8 * text, sint32 * outWidth,
|
||||
|
||||
static TTFSurface * ttf_render(TTF_Font * font, const utf8 * text)
|
||||
{
|
||||
return TTF_RenderUTF8_Solid(font, text, 0x000000FF);
|
||||
return TTF_RenderUTF8_Shaded(font, text, 0x000000FF, 0x000000FF);
|
||||
}
|
||||
|
||||
void ttf_free_surface(TTFSurface * surface)
|
||||
|
||||
Reference in New Issue
Block a user