Fix #103 by disabling subpixel rendering.

Newer versions of FreeType enable subpixel rendering by default. This makes fonts look terrible on displays that don't support it, like the LCDs this library is targeting. This change disables the subpixel rendering and improves the clarity of fonts.

See https://github.com/adafruit/Adafruit-GFX-Library/issues/103#issuecomment-443031001 for more information.
This commit is contained in:
Jason von Nieda 2018-11-29 17:35:18 -06:00 committed by GitHub
parent 85cc1d9508
commit fd68f69d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,6 +117,16 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "FreeType init error: %d", err);
return err;
}
// Use TrueType engine version 35, without subpixel rendering.
// This improves clarity of fonts since this library does not
// support rendering multiple levels of gray in a glyph.
// See https://github.com/adafruit/Adafruit-GFX-Library/issues/103
FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;
FT_Property_Set( library, "truetype",
"interpreter-version",
&interpreter_version );
if((err = FT_New_Face(library, argv[1], 0, &face))) {
fprintf(stderr, "Font load error: %d", err);
FT_Done_FreeType(library);