LCL: control: fix 0-height font scaling

git-svn-id: trunk@54220 -
This commit is contained in:
ondrej 2017-02-21 11:59:27 +00:00
parent 8b4aa08543
commit 00e450bfa7

View File

@ -1877,11 +1877,11 @@ end;
class procedure TControl.DoScaleFontPPI(const AFont: TFont;
const AProportion: Double);
begin
AFont.PixelsPerInch := Round(AFont.PixelsPerInch*AProportion);
// If AFont.PixelsPerInch is different from "Screen.PixelsPerInch" (=GetDeviceCaps(DC, LOGPIXELSX)
// 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 then
AFont.Height := Round(GetFontData(AFont.Reference.Handle).Height*AProportion);
AFont.Height := MulDiv(GetFontData(AFont.Reference.Handle).Height, AFont.PixelsPerInch, Screen.PixelsPerInch);
AFont.PixelsPerInch := Round(AFont.PixelsPerInch*AProportion);
end;
function TControl.IsAParentAligning: boolean;