mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-21 23:22:41 +02:00
LCL-CustomDrawn: Now uses the new TextHeight capabilities from LazFreeType
git-svn-id: trunk@36243 -
This commit is contained in:
parent
5d9dce28f6
commit
dd09dc3868
@ -2223,7 +2223,8 @@ begin
|
||||
end;
|
||||
try
|
||||
ftFont.SizeInPoints:= lFontSize;
|
||||
lFontSize:= MulDiv(lFontSize,72,ftFont.DPI); // convert points to pixels
|
||||
//lFontSize:= MulDiv(lFontSize,72,ftFont.DPI); // convert points to pixels
|
||||
lFontSize := Round(ftFont.TextHeight(Str) * 0.75);// ToDo: Find out why this 75% factor works
|
||||
RealX := X + lDestCanvas.WindowOrg.X + lDestCanvas.BaseWindowOrg.X;
|
||||
RealY := Y + lDestCanvas.WindowOrg.Y + lDestCanvas.BaseWindowOrg.Y + lFontSize;
|
||||
FTDrawer.DrawText(Str, ftFont, RealX, RealY, colBlack, 255);
|
||||
@ -4121,7 +4122,8 @@ begin
|
||||
|
||||
ftFont := TFreeTypeFont(LazDC.ExtraFontData);
|
||||
Size.cx := Round(ftFont.TextWidth(Str));
|
||||
Size.cy := LazDC.AssignedFont.Size;
|
||||
Size.cy := Round(ftFont.TextHeight(Str));
|
||||
if Size.cy = 0 then Size.cy := LazDC.AssignedFont.Size; // crude aproximation
|
||||
if Size.cy = 0 then Size.cy := DefaultFontSize;
|
||||
|
||||
Result := True;
|
||||
|
Loading…
Reference in New Issue
Block a user