• R/O
  • HTTP
  • SSH
  • HTTPS

KCD: Commit

main code repository.


Commit MetaInfo

Revision43cc476b0cab6df34fd1dffc4f34f4884ce9ef0d (tree)
Time2018-08-14 00:05:59
Authormasakih <masakih@user...>
Commitermasakih

Log Message

10.13以降は CGGlyph を使用するようにした

Change Summary

Incremental Difference

--- a/KCD/StrokeTextFieldCell.swift
+++ b/KCD/StrokeTextFieldCell.swift
@@ -69,13 +69,16 @@ final class StrokeTextFieldCell: NSTextFieldCell {
6969 point.y -= controlView.frame.height
7070 }
7171
72- let nsGlyph = UnsafeMutablePointer<NSGlyph>.allocate(capacity: range.length)
73-
74- (0..<range.length).forEach { nsGlyph[$0] = NSGlyph(glyph[$0]) }
75-
7672 let path = NSBezierPath()
7773 path.move(to: point)
78- path.appendGlyphs(nsGlyph, count: glyphLength, in: font)
74+ if #available(macOS 13, *) {
75+ path.append(withCGGlyphs: glyph, count: glyphLength, in: font)
76+ } else {
77+ let nsGlyph = UnsafeMutablePointer<NSGlyph>.allocate(capacity: range.length)
78+
79+ (0..<range.length).forEach { nsGlyph[$0] = NSGlyph(glyph[$0]) }
80+ path.appendGlyphs(nsGlyph, count: glyphLength, in: font)
81+ }
7982 path.lineWidth = StrokeTextFieldCell.boarderWidth
8083 path.lineJoinStyle = .roundLineJoinStyle
8184
Show on old repository browser