LCL: Disable scaling for default fonts, as they are correctly sized taken from OS. Issue #32359

git-svn-id: branches/fixes_1_8@55815 -
This commit is contained in:
mattias 2017-09-08 17:50:35 +00:00
parent 1efd1d4582
commit 9efc4d73f6
2 changed files with 9 additions and 2 deletions

View File

@ -944,7 +944,10 @@ begin
// be used for LCL HighDPI scaling.
// Override this function - list all custom fonts in the overriden procedure
DoFixDesignFontPPI(Font, ADesignTimePPI);
// If the font is a system font (Font.IsDefault), it is correctly
// sized taken at runtime. Issue #32359
if not Font.IsDefault then
DoFixDesignFontPPI(Font, ADesignTimePPI);
end;
procedure TControl.ExecuteCancelAction;
@ -1921,7 +1924,9 @@ procedure TControl.DoScaleFontPPI(const AFont: TFont;
begin
// If AFont.PixelsPerInch is different from "Screen.PixelsPerInch" (=GetDeviceCaps(DC, LOGPIXELSX))
// then the font doesn't scale -> we have to assign a nonzero height value.
if (AFont.Height=0) and not (csDesigning in ComponentState) then
// If the font is a system font (Font.IsDefault), it is correctly
// sized taken at runtime. Issue #32359
if (AFont.Height=0) and not (csDesigning in ComponentState) and not AFont.IsDefault then
AFont.Height := MulDiv(GetFontData(AFont.Reference.Handle).Height, AFont.PixelsPerInch, Screen.PixelsPerInch);
AFont.PixelsPerInch := Round(AFont.PixelsPerInch*AProportion);
end;

View File

@ -858,6 +858,8 @@ begin
OldPPI := FPixelsPerInch;
FPixelsPerInch := APixelsPerInch;
if IsDefault then Exit;
// the Height value is not correct anymore -> force recalculate it
if Height<>0 then
Height := MulDiv(Height, APixelsPerInch, OldPPI);