diff --git a/lcl/interfaces/win32/win32int.pp b/lcl/interfaces/win32/win32int.pp index 7d76e70129..616245853d 100644 --- a/lcl/interfaces/win32/win32int.pp +++ b/lcl/interfaces/win32/win32int.pp @@ -207,6 +207,8 @@ type property CommonControlsVersion: DWord read FCommonControlsVersion; property OnAsyncSocketMsg: TSocketEvent read FOnAsyncSocketMsg write FOnAsyncSocketMsg; property DotsPatternBitmap: HBitmap read GetDotsPatternBitmap; + property Metrics: TNonClientMetrics read FMetrics; + property MetricsFailed: Boolean read FMetricsFailed; end; {$I win32listslh.inc} diff --git a/lcl/interfaces/win32/win32wsdialogs.pp b/lcl/interfaces/win32/win32wsdialogs.pp index 2e6df287f2..99c9298657 100644 --- a/lcl/interfaces/win32/win32wsdialogs.pp +++ b/lcl/interfaces/win32/win32wsdialogs.pp @@ -1198,6 +1198,13 @@ begin LFUnderline := byte(fsUnderline in Font.Style); LFCharSet := Font.CharSet; end; + // Duplicate logic in CreateFontIndirect + if not Win32WidgetSet.MetricsFailed and SameText(Font.Name, DefFontData.Name) then + begin + LFW.lfFaceName := UTF8ToUTF16(Win32WidgetSet.Metrics.lfMessageFont.lfFaceName); + if LFW.lfHeight = 0 then + LFW.lfHeight := Win32WidgetSet.Metrics.lfMessageFont.lfHeight; + end; with CFW do begin LStructSize := sizeof(TChooseFont); @@ -1215,7 +1222,7 @@ begin lpfnHook := @FontDialogCallBack; lCustData := PtrInt(@ACommonDialog); end; - RGBColors := DWORD(Font.Color); + RGBColors := ColorToRGB(Font.Color); if fdLimitSize in Options then begin nSizeMin := MinFontSize;