Post

Replies

Boosts

Views

Activity

CoreText : CTFrame returns unexpected number of CTLine, and one CTLine contains several "\n"
Before iOS 17, CTFrameGetLines(ctFrame) returns exact number of lines it will displayed on the screen. However after iOS 17.2.x, under some unknown condition, it returns less CTLines. It's easy to reproduce: let formattedString = NSMutableAttributedString() formattedString.append(.init(string: "你", attributes: [.font: UIFont.boldSystemFont(ofSize: 14)])) formattedString.append(.init(string: "\n\n\n\n\n\n好\n")) let ctSetter = CTFramesetterCreateWithAttributedString(formattedString as CFAttributedString) let rect = CGRect(x: 0, y: 0, width: 100, height: 1000) let bezierPath = UIBezierPath(rect: rect) let ctFrame = CTFramesetterCreateFrame(ctSetter, CFRangeMake(0, formattedString.length), bezierPath.cgPath, nil) let ctLines = CTFrameGetLines(ctFrame) print("CTLine count: \(CFArrayGetCount(ctLines))") The test code above should print CTLine count: 7, but actually it returns 4. One weird CTLine is like: - 1 : <CTLine: 0x3031e0780>{run count = 1, string range = (2, 3), width = 0, A/D/L = 9.24023/2.75977/0, glyph count = 3, runs = ( <CTRun: 0x10173ec50>{string range = (2, 3), string = "\n\n\n", attributes = { NSFont = "<UICTFont: 0x101728800> font-family: \"Helvetica\"; font-weight: normal; font-style: normal; font-size: 12.00pt"; }} ) } never met this issue before, is it a bug or just new feature...
0
0
440
May ’24
Xcode 15 can't install iOS 17 platform simulator
I installed Xcode 15 and on first openning it auto downloaded iOS 17 simulator but failed to install. The error info is : Failed to copy file /Users/kelanjiang/Library/Caches/com.apple.dt.Xcode/Downloads/com.apple.dmg.iPhoneSimulatorSDK17_0-17.0.0.0.dmg to /Library/Developer/CoreSimulator/Images/Inbox/43457D23-59DB-496A-B682-85D8F92F4FC7.dmg.copying Domain: SimDiskImageErrorDomain Code: 6 User Info: { DVTErrorCreationDateKey = "2023-09-25 10:26:12 +0000"; unusableErrorDetail = "Error Domain=NSPOSIXErrorDomain Code=2 \"No such file or directory\" UserInfo={NSLocalizedDescription=Failed to copy file /Users/kelanjiang/Library/Caches/com.apple.dt.Xcode/Downloads/com.apple.dmg.iPhoneSimulatorSDK17_0-17.0.0.0.dmg to /Library/Developer/CoreSimulator/Images/Inbox/43457D23-59DB-496A-B682-85D8F92F4FC7.dmg.copying}"; } -- System Information macOS Version 13.6 (Build 22G120) Xcode 15.0 (22265) (Build 15A240d) Timestamp: 2023-09-25T18:26:12+08:00 The sreenshot is like: I tried to reinstall Xcode and clean some cache files but still have the same issue and same appearence in this setting page. Any advises would be helpful
5
2
4.3k
Sep ’23