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.
This commit is contained in:
Francesco Abbate 2021-12-15 14:52:34 +01:00
parent 997b3efbb7
commit 91e30113cd
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ static int font_set_render_options(RenFont* font) {
if (font->antialiasing == FONT_ANTIALIASING_NONE) if (font->antialiasing == FONT_ANTIALIASING_NONE)
return FT_RENDER_MODE_MONO; return FT_RENDER_MODE_MONO;
if (font->antialiasing == FONT_ANTIALIASING_SUBPIXEL) { 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) { switch (font->hinting) {
case FONT_HINTING_NONE: FT_Library_SetLcdFilter(library, FT_LCD_FILTER_NONE); break; case FONT_HINTING_NONE: FT_Library_SetLcdFilter(library, FT_LCD_FILTER_NONE); break;
case FONT_HINTING_SLIGHT: case FONT_HINTING_SLIGHT: