From 759fc1b0f34d1caa8a9c0debba38466717db1928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20J=C3=B6nsson?= Date: Thu, 25 Jun 2015 19:20:42 +0200 Subject: [PATCH] ui: only set font quality if ClearType is enabled (fixes #216, closes #311, closes #327) --- PowerEditor/src/Notepad_plus.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 1bdb89bc..c5a9ad05 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -296,8 +296,20 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); - _mainEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED); - _subEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED); + UINT smoothingType = 0; + if (0 != ::SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smoothingType, 0)) + { + if (FE_FONTSMOOTHINGCLEARTYPE == smoothingType) + { + _mainEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED); + _subEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED); + } + } + else + { + // Fail silently - font smoothing is not important enough to do anything else. + assert(false and "failed to retrieve system info 'SPI_GETFONTSMOOTHINGTYPE'"); + } _mainEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true); _subEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);