summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-31 08:18:33 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-31 08:18:33 +0000
commit432f82c4a7b44ef3a4a858b43c845e2df6148e66 (patch)
tree81d42aa933bddc893b89ab7c09878ed11bd63822
parent81e9f95ba0fc2124dbfb3fd027670b3fbbfbfffb (diff)
downloadfpGUI-432f82c4a7b44ef3a4a858b43c845e2df6148e66.tar.xz
* Applied a ClearType / Anti-aliasing fix for GDI. Created by Vladimir.
-rw-r--r--src/corelib/gdi/gfx_gdi.pas16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas
index b9211a63..e620ac26 100644
--- a/src/corelib/gdi/gfx_gdi.pas
+++ b/src/corelib/gdi/gfx_gdi.pas
@@ -34,11 +34,14 @@ uses
const
WM_MOUSEWHEEL = $020a; // we could remove this since FPC 2.0.4
VER_PLATFORM_WIN32_CE = 3;
+ CLEARTYPE_QUALITY = 5;
-{ Unicode selection variables }
var
+ { Unicode selection variables }
UnicodeEnabledOS: Boolean;
WinVersion: TOSVersionInfo;
+ { Font smoothing type selection variable }
+ FontSmoothingType: Cardinal;
type
TfpgGContext = HDC;
@@ -1776,7 +1779,7 @@ begin
lfUnderline := 0;
lfStrikeOut := 0;
lfCharSet := DEFAULT_CHARSET; //0; //Byte(Font.Charset);
- lfQuality := ANTIALIASED_QUALITY;
+ lfQuality := Byte(FontSmoothingType);
{ Everything else as default }
lfOutPrecision := OUT_DEFAULT_PRECIS;
lfClipPrecision := CLIP_DEFAULT_PRECIS;
@@ -1818,6 +1821,8 @@ begin
lf.lfItalic := 1
else if prop = 'ANTIALIAS' then
if propval = 'FALSE' then
+ lf.lfQuality := NONANTIALIASED_QUALITY else
+ if propval = 'DEFAULT' then
lf.lfQuality := DEFAULT_QUALITY;
end;
@@ -2048,11 +2053,18 @@ initialization
{$IFDEF WinCE}
UnicodeEnabledOS := True;
+ FontSmoothingType := DEFAULT_QUALITY;
{$ELSE}
WinVersion.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
GetVersionEx(WinVersion);
UnicodeEnabledOS := (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) or
(WinVersion.dwPlatformID = VER_PLATFORM_WIN32_CE);
+
+ if SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, @FontSmoothingType, 0)
+ and (FontSmoothingType = FE_FONTSMOOTHINGCLEARTYPE) then
+ FontSmoothingType := CLEARTYPE_QUALITY
+ else
+ FontSmoothingType := ANTIALIASED_QUALITY;
{$ENDIF}
end.