win32: TWin32WidgetSet.CreateFontIndirect: correctly resolve default font height. Issue #36571. Patch from Yuriy Sydorov

git-svn-id: trunk@62549 -
This commit is contained in:
ondrej 2020-01-14 14:34:02 +00:00
parent d3dab158dc
commit 000aa3e559

View File

@ -849,16 +849,16 @@ begin
FontName := LogFont.lfFaceName; FontName := LogFont.lfFaceName;
TempLogFont := LogFont; TempLogFont := LogFont;
if SameText(FontName, DefFontData.Name) then if IsFontNameDefault(FontName) then
begin begin
TempLogFontW.lfFaceName := UTF8ToUTF16(FMetrics.lfMessageFont.lfFaceName); // FMetrics must be UTF16 TempLogFontW.lfFaceName := UTF8ToUTF16(FMetrics.lfMessageFont.lfFaceName); // FMetrics must be UTF16
if TempLogFont.lfHeight = 0 then
TempLogFont.lfHeight := FMetrics.lfMessageFont.lfHeight;
end end
else else
begin begin
TempLogFontW.lfFaceName := UTF8ToUTF16(FontName); TempLogFontW.lfFaceName := UTF8ToUTF16(FontName);
end; end;
if TempLogFont.lfHeight = 0 then
TempLogFont.lfHeight := FMetrics.lfMessageFont.lfHeight;
Result := Windows.CreateFontIndirectW(@TempLogFontW); Result := Windows.CreateFontIndirectW(@TempLogFontW);
end; end;