From c80ac6d788b45fa0e1acbb9357e46dfcc05489d4 Mon Sep 17 00:00:00 2001 From: booster Date: Thu, 31 Oct 2024 17:14:03 +0300 Subject: [PATCH] Sources update commit_hash:5a66dc5de330cc2427cdbb17a5c44f87a2dbd50a --- VGSLUI/extensions/NSAttributedStringExtensions.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/VGSLUI/extensions/NSAttributedStringExtensions.swift b/VGSLUI/extensions/NSAttributedStringExtensions.swift index 8641bc4..24883ad 100644 --- a/VGSLUI/extensions/NSAttributedStringExtensions.swift +++ b/VGSLUI/extensions/NSAttributedStringExtensions.swift @@ -1296,13 +1296,15 @@ extension CTLine { } private func drawStrikethrough(for run: CTRun, at position: CGPoint, in context: CGContext) { + let lineWidth = run.font.estimatedStrikethroughWidth + context.saveGState() context.setStrokeColor(run.color) - context.setLineWidth(run.font.estimatedStrikethroughWidth) + context.setLineWidth(lineWidth) context.addPath( run.strikethroughLine( forTextPosition: position, - offset: run.baselineOffset + ceil(run.font.xHeight * 0.5) + offset: run.baselineOffset + ceil((run.font.xHeight - lineWidth) * 0.5) ) ) context.strokePath() @@ -1317,11 +1319,11 @@ extension CTLine { var underlinePath = run.strikethroughLine( forTextPosition: position, - offset: run.font.underlinePosition + offset: run.font.underlinePosition - run.font.underlineThickness * 0.5 ) for glyphPath in run.glyphPaths(runPosition: position) { let thickedPath = glyphPath.copy( - strokingWithWidth: run.font.estimatedStrikethroughWidth, + strokingWithWidth: run.font.underlineThickness * 3, lineCap: .round, lineJoin: .round, miterLimit: 0