Spelling, Open Standards, and Mac Word

One of the most welcome additions to the Mac weblogging world recently has been Rick Schaut, an employee of one of the platform’s biggest third party developers: Microsoft. Rick is a Mac veteran who has shepherded Mac Office through many a release, and his experience makes for some good reading (see his articles on ill-conceived Carbon vs. Cocoa debates and the infamous Mac Word 6.0 for good examples).

Unfortunately, the very mention of Microsoft often creates a fair amount of rancor among Mac users, and, as my old sparring partner Robb Beal points out on his weblog, Rick has already gotten an earful from angry Office user Pierre Igot regarding Office’s lack of support for native OS X facilities like Address Book and the system spell checker.

Essentially, Igot blames Microsoft for ignoring its users’ needs, while Schaut blames Apple for failing to make spell checker open enough to be easily integrated into Word’s combined grammar/spell-checking code. To repeat the same Schaut quote that Robb hammers home using the time-honored tactic of triple repetition:

And, while were on the subject of “open” standards, why does Apple’s “open” standard force me to rewrite my code? Why can’t I just get the data from their spelling checker? (I searched. If it is, indeed, possible to do so, Apple have buried the documentation for it rather deeply.)

Fortunately, while I’ll let those who are knowledgable about Microsoft’s code decide whether what Igot is proposing is worth its opportunity cost, I’m happy to report that Schaut’s assessment of the technical barriers to spell checker integration may be a bit pessimistic.

You see, there is indeed a documented, public API that provides programmatic access to OS X’s system spell checker: Cocoa’s NSSpellChecker. Using NSSpellChecker, developers can check an arbitrary string and get back the range of the first misspelled word, get a list of suggested alternatives, and (under Panther) obtain a list of possible completions for a given word fragment. Apple tech pubs even provides a sample project demonstrating how to use NSSpellChecker from a Carbon app like Word.

The only thing I could see as a real barrier here is that the API doesn’t seem to provide a direct way to actually add words to the dictionary (it would also admittedly be nicer for Schaut’s purposes if there was a similar procedural C API). Still, while I certainly don’t speak for them, I would venture to guess that Apple’s frameworks engineers might just be willing to consider adding that functionality if they knew the developer of the preeminent word processing app for OS X considered it important.

Leave a Reply