mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-22 14:42:32 +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;
|
end;
|
||||||
try
|
try
|
||||||
ftFont.SizeInPoints:= lFontSize;
|
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;
|
RealX := X + lDestCanvas.WindowOrg.X + lDestCanvas.BaseWindowOrg.X;
|
||||||
RealY := Y + lDestCanvas.WindowOrg.Y + lDestCanvas.BaseWindowOrg.Y + lFontSize;
|
RealY := Y + lDestCanvas.WindowOrg.Y + lDestCanvas.BaseWindowOrg.Y + lFontSize;
|
||||||
FTDrawer.DrawText(Str, ftFont, RealX, RealY, colBlack, 255);
|
FTDrawer.DrawText(Str, ftFont, RealX, RealY, colBlack, 255);
|
||||||
@ -4121,7 +4122,8 @@ begin
|
|||||||
|
|
||||||
ftFont := TFreeTypeFont(LazDC.ExtraFontData);
|
ftFont := TFreeTypeFont(LazDC.ExtraFontData);
|
||||||
Size.cx := Round(ftFont.TextWidth(Str));
|
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;
|
if Size.cy = 0 then Size.cy := DefaultFontSize;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user