1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Make font hinting optional through config.ini.

This commit is contained in:
Aaron van Geffen
2017-09-22 18:03:21 +02:00
committed by Marijn van der Werf
parent ea034e85fa
commit 2dcf9c73e7
4 changed files with 14 additions and 2 deletions

View File

@@ -493,6 +493,7 @@ namespace Config
model->height_small = reader->GetSint32("height_small", false);
model->height_medium = reader->GetSint32("height_medium", false);
model->height_big = reader->GetSint32("height_big", false);
model->enable_hinting = reader->GetBoolean("enable_hinting", true);
}
}
@@ -512,6 +513,7 @@ namespace Config
writer->WriteSint32("height_small", model->height_small);
writer->WriteSint32("height_medium", model->height_medium);
writer->WriteSint32("height_big", model->height_big);
writer->WriteBoolean("enable_hinting", model->enable_hinting);
}
static bool SetDefaults()

View File

@@ -191,6 +191,7 @@ typedef struct FontConfiguration
sint32 height_small;
sint32 height_medium;
sint32 height_big;
bool enable_hinting;
} FontConfiguration;
enum SORT

View File

@@ -14,6 +14,7 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../interface/colour.h"
#include "../interface/viewport.h"
#include "../localisation/localisation.h"
@@ -799,7 +800,7 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
*(dst + width + dstScanSkip + 1) = info->palette[3];
}
if (*src > 180)
if (*src > 180 || !gConfigFonts.enable_hinting)
{
// Centre of the glyph: use full colour.
*dst = colour;

View File

@@ -19,6 +19,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include "../config/Config.h"
#include "../localisation/localisation.h"
#include "../OpenRCT2.h"
#include "../platform/platform.h"
@@ -276,7 +277,14 @@ 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_Shaded(font, text, 0x000000FF, 0x000000FF);
if (gConfigFonts.enable_hinting)
{
return TTF_RenderUTF8_Shaded(font, text, 0x000000FF, 0x000000FF);
}
else
{
return TTF_RenderUTF8_Solid(font, text, 0x000000FF);
}
}
void ttf_free_surface(TTFSurface * surface)