From 91e30113cdcc88e83093937c6c60c75e4516da1a Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 15 Dec 2021 14:52:34 +0100 Subject: [PATCH] Use better LCD filter weight for subpixel rendering Based on: https://freetype.org/freetype2/docs/reference/ft2-lcd_rendering.html the coefficients should be normalized which was not the case. We use the values previously used with the AGG library implementation. The new coefficients are normalized and creates maybe less color fringes. Ultimately it is difficult and subjective to say which coefficients are better and the answer may depends on the vision of the person or on the characteristics of the used monitor. --- src/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer.c b/src/renderer.c index b0e17f58..58a52c49 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -76,7 +76,7 @@ static int font_set_render_options(RenFont* font) { if (font->antialiasing == FONT_ANTIALIASING_NONE) return FT_RENDER_MODE_MONO; if (font->antialiasing == FONT_ANTIALIASING_SUBPIXEL) { - unsigned char weights[] = { 0x10, 0x40, 0x70, 0x40, 0x10 } ; + unsigned char weights[] = { 0x17, 0x2f, 0x74, 0x2f, 0x17 } ; switch (font->hinting) { case FONT_HINTING_NONE: FT_Library_SetLcdFilter(library, FT_LCD_FILTER_NONE); break; case FONT_HINTING_SLIGHT: