Post

Replies

Boosts

Views

Activity

What is the criterion for Font Book's "English" Language group
I've created a font family, but Font Book refuses to include it in the English language set, despite my best efforts. The font has every glyph in the OpenType "Std" set, plus several others. I've checked various boxes for Latin 1 and Macintosh Character Codepages; plus Unicode ranges for Basic Latin, additional Latin, etc, etc. I've compared it to several other fonts that are in the English set, and I can't see anything that they have that my fonts don't. (In fact, many of them seem to have much less!) I've created other fonts that are in the English set, but I've no idea what the difference is. Given that macOS relies on these Language sets, in order to hide the thousands of unnecessary fonts that are permanently installed in the OS, there ought to be some guidance on how to do this.
0
0
394
Nov ’24
How does font caching / resources for each app work?
I'm a font developer. In the development process, I will revise a font and overwrite the OTF file that is currently enabled (registered) with macOS. If I then launch an app, it will immediately use the revised version of the font; while apps that are already loaded will continue to use the old version. This suggests that each app is loading new and separate font data, rather than getting it from some existing cache in memory. Yet macOS does have a "font cache" of some sort. Some apps, like TextEdit, seem to only load the fonts that they need to use. However, other apps, like Pages, load every enabled (registered) font on the OS!! (According to the Open Files list in Activity Monitor.) Given that /System/Library/Fonts/ is 625 Mb, and we can't disable any of it, isn't that a lot of data to be repeating? How many fonts is too many fonts? I can't find much documentation about the process.
0
0
506
Sep ’24
Memory leak: NSIdleTimer, sleep?
I have a MacOS app with a memory leak. According to the Leaks.app, there's a problem with NSIdleTimer's setHandler method. I'm not using that object (which I can't find any documentation on). But I am using: sleep(1) as a means of preventing a race condition. Might that be the cause? Anything I need to do with sleep to deallocate memory? Or is it an OS bug?
2
0
887
Sep ’23
Swift Package Manager: Validation / "no such file"
I'm trying to create a Command Line Tool that uses the ArgumentParser swift package. I've added the package to my project, and initially I got a lot of errors: Library not loaded (code signature in PackageFrameworks/ArgumentParser.framework/Versions/A/ArgumentParser' not valid for use in process: (no such file, not in dyld cache) I fixed it by disabling Library Validation in the Build Options, and my tool runs in Xcode beautifully. But the compiled executable won't work in Terminal, flagging the same errors. I presume it's some signing/security thing (as usual), and I just need to set the right Build Options, but I haven't a clue which ones. I tried "Always Embed Swift Libraries", but that produced a warning message: the product type 'com.apple.product-type.tool' is not a wrapper type. Anyone know what might be going on?
4
0
2.1k
Dec ’22
QuickLook on macOS: various questions
I'm trying to create a custom Quick Look preview on macOS. I've found the Quick Look Preview Extension target, which is brilliant, and does most of the 'heavy' lifting, but I've run into a few problems. I'm implementing a preview for MIDI files (which has been missing since 2009...) using AVMIDIPlayer. The player keeps playing when the file is no longer selected! What's the mechanism for fixing that? Some sort of check that the view exists..? I notice that the OS preview for audio files has a different interface for the Finder's preview column and for the QuickLook 'pop-up' window. Again, I can't see how you define different views for those two environments. Is there any documentation that's specifically "Mac"? I can only find iOS stuff. (Same for third-party tutorials.)
2
1
2.0k
Jul ’22
Understanding Optionals and Types (again)
I have a real problem trying to get to grips with the whole Optionals/wrapping thing, and associated type issues. Here's my code: import Quartz import Foundation func listFilters() -> Void { let theFilters = QuartzFilterManager.filters(inDomains: nil)! for eachFilter in theFilters as! [QuartzFilter] { print(eachFilter.localizedName()!, ":", eachFilter.url().path) } } listFilters() So, in the first line of the function, I have to explicitly force unwrap the result of the method that returns a list of QuartzFilters. (Why?) The very next line, I have to force them to be of type QuartzFilters, (because why wouldn't the method return the actual type of thing that they are?) And then on the third line, I still have to force unwrap one of the properties of something that I've already unwrapped (otherwise I get optionals), but not the other one. Yes, I understand it's all about trying to prevent a null condition, but nearly everything is never null. Even if I use if let on the first line, I'm still unwrapping stuff inside that if.
2
0
1k
May ’22
How to use ippeveprinter
Now that CUPS backends, filters and PPDs are deprecated, I'm trying to set up a print to file queue using ippeveprinter. But I can't get it to work. Anyone know anything about it? I've tried: ippeveprinter -D file:///Users/Shared/Print/Out -F application/pdf -c /usr/local/bin/pscommand.sh myprinter and then created a shell command that runs: cupsfilter $1 I've tried it without the -c flag as well. Sometimes I've produced .prn files, and occasionally .urf files (but without changing anything I've also got zero length files). But I just can't get a PDF into my destination folder.
0
0
1.3k
Nov ’21
printtool process sandboxed to oblivion: PDF Services don't work
Since Big Sur, the printtool process has been sandboxed, with the result that it's now so secure, it can't do anything. As a consequence, PDF Services (items in ~/Library/PDF Services) no longer work. An alias to a folder outside the user domain, such as /Users/Shared/, no longer saves the PDF file to that location. Shell scripts, python, and even compiled Swift binaries no long run. Even Automator Print plug-ins no longer function. Adding printtool to Full Disk Access doesn't work either. ("If in doubt, add the process to Full Disk Access.") The ability to process PDFs directly from the print dialog goes back to Tiger (I think) and has been massively useful for years. Yes, I suppose some malware could save a script to the user PDF Services folder, and then some unwitting user could run it from the print dialog, but.... At the very least, some new documentation about how PDF Services are now supposed to work would be crucial.
2
0
1.8k
Jul ’21
Bug or problem with indexing PDFOutline in PDFKit
I'm not sure whether this is a bug in PDFKit, or something wrong with my implementation of it. I'm creating PDFOutlines (a Table of Contents) programmatically to an existing PDF file using python.The code 'appears' to work: the ToC is shown in Preview's sidebar, and in Acrobat's Bookmarks pane; and in other PDF readers. However, when I Preflight the PDF in Acrobat, I get syntax errors flagged, which show that there's something mad going on in the data. For three PDFOutlines, I get the following:2 0 obj << /First 57 0 R /Last 58 0 R >> endobj 58 0 obj << /Prev 59 0 R /Count 0 /Title (Page 3) /Dest [ 31 0 R /XYZ 0 842 null ] /Parent 60 0 R >> endobj 60 0 obj << >> endobj 59 0 obj << /Parent 61 0 R >> endobj 61 0 obj << >> endobj 57 0 obj << /Dest [ 4 0 R /XYZ 0 842 null ] /Count 0 /Title (Page 1) /Next 62 0 R /Parent 63 0 R >> endobj 63 0 obj << >> endobj 62 0 obj << /Prev 64 0 R /Count 0 /Title (Page 2) /Dest [ 25 0 R /XYZ 0 842 null ] /Next 65 0 R /Parent 61 0 R >> endobj 65 0 obj << /Prev 59 0 R /Count 0 /Title (Page 3) /Dest [ 31 0 R /XYZ 0 842 null ] /Parent 60 0 R >> endobj 64 0 obj << /Parent 63 0 R >> endobjFor anyone not familiar with the insides of PDF: I have the Outline for Page 3 appearing twice; and each Outline is pointing to a different, blank Parent, instead of object number 2. Acrobat flags objects 60, 61, 63 as missing Parent and Title fields; 64 and 59 lack Title fields only. Correct syntax should be the 3 Outlines having object 2 as their Parent, and none of the other objects being there.Here's my code in python:def getOutline(page, label): # Create Destination myPage = myPDF.pageAtIndex_(page) pageSize = myPage.boundsForBox_(Quartz.kCGPDFMediaBox) x = 0 y = Quartz.CGRectGetMaxY(pageSize) pagePoint = Quartz.CGPointMake(x,y) myDestination = Quartz.PDFDestination.alloc().initWithPage_atPoint_(myPage, pagePoint) myLabel = NSString.stringWithString_(label) myOutline = Quartz.PDFOutline.alloc().init() myOutline.setLabel_(myLabel) myOutline.setDestination_(myDestination) return myOutline if __name__ == "__main__": pdfURL = NSURL.fileURLWithPath_(infile) print pdfURL myPDF = Quartz.PDFDocument.alloc().initWithURL_(pdfURL) print myPDF if myPDF: # Create Outlines. Add the Page Index (from 0) and label in pairs here: myTableOfContents = [ (0, 'Page 1'), (1, 'Page 2'), (2, 'Page 3') ] allMyOutlines = [] for index, outline in myTableOfContents: allMyOutlines.append(getOutline(index, outline)) # Create a root Outline and add each outline rootOutline = Quartz.PDFOutline.alloc().init() for index, value in enumerate(allMyOutlines): rootOutline.insertChild_atIndex_(value, index) myPDF.setOutlineRoot_(rootOutline) myPDF.writeToFile_(outfile)There's a function at the top which creates an outline from a label string and page number. Each outline gets put into a dict, and then inserted as a Child of the root Outline. Am I doing it wrong, or is it a bug?
2
0
1.9k
Mar ’19