Post

Replies

Boosts

Views

Activity

macOS 14 - NSAttributedString created from HTML displays as "undefined character" glyphs when certain fonts are used
I allow users to choose a font to use throughout the app, then display text using that font in 3 different ways: As the default body font of an HTML document displayed in a WKWebView. Used to create an NSAttributedString then displayed in an NSTextField. Used as the body font of a very small HTML document (2-3 lines), converted to NSAttributedString, then displayed in an NSTextField. My code has been working fine for years, but starting with the release of Sonoma (macOS 14), any text that is converted from HTML to NSAttributedString displays as all "question marks in boxes" for each character. This happens when certain fonts are used. In particular I've seen it with Calibri, Candara, and SF Pro. Calibri and Candara are Microsoft fonts and I think are distributed with MS Office. SF Pro is an Apple font. There could be others; I haven't done an exhaustive check. What I can tell you is that this has been working fine literally until a couple weeks ago when customers began installing macOS 14. If they go into my app and select a different font (such as Arial or Times New Roman) everything works fine. It is only certain fonts that don't work, and those fonts work when used as the body font of an HTML document in WKWebView and when used as the font for a new NSAttributedString. They just don't work if you make a little HTML document with the font selected as the body font, then convert to NSAttributedString. Here's the code that worked up until macOS 14: NSString *htmlString = @"<!DOCTYPE html>" "<html>" "<head>" "<style>" "body { font-family: 'Candara', serif; font-size: 14px; }" "</style>" "</head>" "<body>" "This won't display right." "</body>" "</html>"; NSData *htmlData = [htmlString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}; NSError *error; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:htmlData options:options documentAttributes:nil error:&error]; Note the fallback of "serif" — that doesn't matter. you get all undefined characters and the fallback font is not used. It's as if the renderer really believes the font is usable, but it isn't.
1
0
779
Nov ’23
Xcode 12.2 beta 2 crashes on launch
Downloaded latest Xcode. When I launch it, I get: UNCAUGHT EXCEPTION (NSInvalidArgumentException): +[OAHSoftwareUpdateController updateIsInstalled]: unrecognized selector sent to class 0x106bd57c0 Stack trace: 0 _exceptionPreprocess (in CoreFoundation) 1 DVTFailureHintExceptionPreprocessor (in DVTFoundation) 2 objcexceptionthrow (in libobjc.A.dylib) 3 CFExceptionProem (in CoreFoundation) 4 forwarding (in CoreFoundation) 5 CFforwardingprep0 (in CoreFoundation) 6 +[IDERosettaUpdateController needToInstallRosetta] (in IDEFoundation) 7 -[IDEFirstLaunchExperienceViewController firstLaunchExperienceNeeded] (in IDEKit) 8 -[IDEFirstLaunchExperienceViewController showFirstLaunchExperienceModallyIfNecessary] (in IDEKit) 9 -[IDEWelcomeWindowController showFirstLaunchExperienceIfAppropriate] (in IDEKit) 10 -[IDEWelcomeWindowController openWelcomeWindowAfterFirstLaunchExperienceIfAppropriate:] (in IDEKit) 11 -[IDEApplicationController applicationOpenUntitledFile:] (in IDEKit) 12 -[NSApplication doOpenUntitled] (in AppKit) 13 _58-[NSApplication(NSAppleEventHandling) handleAEOpenEvent:]blockinvoke (in AppKit) 14 _90-[NSDocumentController(NSInternal) autoreopenDocumentsFromRecords:withCompletionHandler:]blockinvoke (in AppKit) 15 -[NSDocumentController(NSInternal) autoreopenDocumentsFromRecords:withCompletionHandler:] (in AppKit) 16 97-[NSDocumentController(NSInternal) autoreopenDocumentsIgnoringExpendable:withCompletionHandler:]blockinvoke3 (in AppKit) 17 -[NSDocumentController(NSInternal) autoreopenDocumentsIgnoringExpendable:withCompletionHandler:] (in AppKit) 18 -[NSApplication reopenWindowsAsNecessaryIncludingRestorableState:completionHandler:] (in AppKit) 19 -[NSApplication(NSAppleEventHandling) handleAEOpenEvent:] (in AppKit) 20 -[NSApplication(NSAppleEventHandling) handleCoreEvent:withReplyEvent:] (in AppKit) 21 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] (in Foundation) 22 -[NSAppleEventManager(DVTAssertionOverrides) swizzleDispatchRawAppleEvent:withRawReply:handlerRefCon:] (in IDEKit) 23 NSAppleEventManagerGenericHandler (in Foundation) 24 0x00000001a6f2a114 (in AE) 25 0x00000001a6f29970 (in AE) 26 aeProcessAppleEvent (in AE) 27 AEProcessAppleEvent (in HIToolbox) 28 DPSNextEvent (in AppKit) 29 -[NSApplication(NSEvent) nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit) 30 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit) 31 -[NSApplication run] (in AppKit) 32 NSApplicationMain (in AppKit) 33 start (in libdyld.dylib)
0
0
448
Nov ’20
Can't download Big Sur 11.0.1 RC 2 to DTK machine
Attempting to update over the last couple of days just returns "Download failed. An error occurred while downloading the selected updates. Please check your internet connection and try again." Internet connection is fine. I can do anything else I want using the internet; just can't update Mac OS. Trying to download to Apple Development Platform running 11.0 Beta (20A5299w)
0
0
532
Nov ’20