From af35953fc14f9d2102b98bdd65a964a27c661400 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Mon, 8 Jul 2024 22:55:48 -0300 Subject: [PATCH] improve text rendering consistency when using fractional DPI scales. --- src/modules/font/freetype/TrueTypeRasterizer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/font/freetype/TrueTypeRasterizer.cpp b/src/modules/font/freetype/TrueTypeRasterizer.cpp index 9aa4677f2..e5f30c76e 100644 --- a/src/modules/font/freetype/TrueTypeRasterizer.cpp +++ b/src/modules/font/freetype/TrueTypeRasterizer.cpp @@ -38,7 +38,6 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, love::Data *data, int , hinting(settings.hinting) { dpiScale = settings.dpiScale.get(defaultdpiscale); - size = floorf(size * dpiScale + 0.5f); sdf = settings.sdf; @@ -55,7 +54,7 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, love::Data *data, int if (err != FT_Err_Ok) throw love::Exception("TrueType Font loading error: FT_New_Face failed: 0x%x (problem with font file?)", err); - err = FT_Set_Pixel_Sizes(face, size, size); + err = FT_Set_Char_Size(face, size << 6, size << 6, 72 * dpiScale, 72 * dpiScale); if (err != FT_Err_Ok) throw love::Exception("TrueType Font loading error: FT_Set_Pixel_Sizes failed: 0x%x (invalid size?)", err);