Skip to content

Commit

Permalink
Sources update
Browse files Browse the repository at this point in the history
commit_hash:5a66dc5de330cc2427cdbb17a5c44f87a2dbd50a
  • Loading branch information
booster committed Oct 31, 2024
1 parent 7ba1a03 commit c80ac6d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions VGSLUI/extensions/NSAttributedStringExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit c80ac6d

Please sign in to comment.