                 path.move(to: endPoint, transform: transform)
                 path.addLine(to: endPoint.offsetBy(dx: -max(size.width - 2 * margin, arrow.width), dy: 0), transform: transform)
                 // arrow head
-                path.move(to: endPoint.offsetBy(dx: -arrow.width, dy: +arrow.height), transform: transform)
-                path.addLine(to: endPoint, transform: transform)
+                path.move(to: endPoint, transform: transform)
+                path.addLine(to: endPoint.offsetBy(dx: -arrow.width, dy: +arrow.height), transform: transform)
+                path.move(to: endPoint, transform: transform)
                 path.addLine(to: endPoint.offsetBy(dx: -arrow.width, dy: -arrow.height), transform: transform)
                 return path
             

                            radius: radius, startAngle: -.pi / 2, endAngle: .pi / 2, clockwise: false)
                path.addLine(to: CGPoint(x: 0.2 * size.height, y: y + radius))
                // arrow head
                path.move(to: CGPoint(x: 0.5 * size.height, y: y + radius + 0.25 * size.height))
                path.addLine(to: CGPoint(x: 0.2 * size.height, y: y + radius))
                path.addLine(to: CGPoint(x: 0.5 * size.height, y: y + radius - 0.25 * size.height))
                if isRTL, let flippedPath = path.copy(using: [CGAffineTransform(scaleX: -1, y: 1)]) {
                    return flippedPath

            : baselineOffset
        var pathCache: [Invisible: CGPath] = [:]
        
        color.set()
        
        // draw invisibles glyph by glyph
        let characterRange = self.characterRange(forGlyphRange: glyphsToShow, actualGlyphRange: nil)
        for charIndex in characterRange.lowerBound..<characterRange.upperBound {
            let codeUnit = string.character(at: charIndex)
