diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.inc index 111646cd6f..1e028add9b 100644 --- a/lcl/interfaces/customdrawn/customdrawnwinapi.inc +++ b/lcl/interfaces/customdrawn/customdrawnwinapi.inc @@ -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;