LCL-CustomDrawn: Now uses the new TextHeight capabilities from LazFreeType

git-svn-id: trunk@36243 -
This commit is contained in:
sekelsenmat 2012-03-23 07:15:25 +00:00
parent 5d9dce28f6
commit dd09dc3868

View File

@ -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;