mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 15:00:31 +02:00
Cocoa: TCocoaContext.GetTextExtentPoint() height correction (its height now matches the font text extents), patch by David Jenkins, issue #39649
This commit is contained in:
parent
005bd07b0e
commit
ddb029aa77
@ -2198,7 +2198,7 @@ var
|
||||
s : NSString;
|
||||
AttribStr : CFAttributedStringRef;
|
||||
CoreLine : CTLineRef;
|
||||
r : NSRect;
|
||||
height, width, asc, dsc, lead: CGFloat;
|
||||
begin
|
||||
S := NSStringUtf8(AStr, ACount);
|
||||
|
||||
@ -2214,9 +2214,10 @@ begin
|
||||
begin
|
||||
CoreLine := CTLineCreateWithAttributedString(CFAttributedStringRef(AttribStr));
|
||||
try
|
||||
r := CTLineGetBoundsWithOptions(CoreLine, 0);
|
||||
Size.cx := Round(r.size.width);
|
||||
Size.cy := Round(r.Size.height);
|
||||
width := CTLineGetTypographicBounds(CoreLine, @asc, @dsc, @lead);
|
||||
height := asc + abs(dsc) + lead;
|
||||
Size.cx := Round(width);
|
||||
Size.cy := Round(height);
|
||||
finally
|
||||
CFRelease(CoreLine);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user