Loud ramblings of a Software Artisan

Tuesday 20 September 2005

Apple closing XML file format?

Tim Bray point out that Apple release the documentation for developer around iWork, their office software suite including Keynote 2, the presentation software and Pages, the DTP/word processing software.

The documentation states:

This document does not describe the complete XML schema for either Pages 1.x or Keynote 2.x. The complete XML schema for both applications is not available and will not be made public.

Wow. I love so much openness. Keynote 1.0 had an open format, but not Keynote 2.0. OK it is XML so more readable than binary files, but it is still lot of work to reverse engineer.

That remind me when I requested Apple the AppleWorks file format documentation. The reason why they didn't want to provide it is "we don't want people to write buggy documents that would crash our software", which is the opposite from Macromedia about flash b.s. (read on, I got it as a comment).

Now people brought the debate in the mailing list. Apple product manager reply is awesome:

We're not trying to sell iWork to CIOs and government agencies that are pursuing long-term document archival strategies a la Office XML. We're selling it to consumers and creative professionals who want Apple's legendary ease-of-use and innovation.

So because you are not a fortune 500 or a government you are not allowed to recover your data later? So much for the lost manuscript of some famous (to be) author (Jules Verne for example whose manuscript written in the 19th centure was found and publish in the mid 90's of the 20th century), etc.

Sorry Apple, but you are making yourself ridiculous. Even more than Microsoft, because in that case you don't have a de-facto monopoly associated to a vendor lock in.

Wednesday 14 September 2005

Hidden API for MacOS X

As I mentionned before, Apple released WebKit as an open source project. WebKit is much more than WebCore, as it also contains all the MacOS X specific rendering code for the HTML engine that is KHTML. I was enjoying to have a look at the code as it would should me how to achieve a fast text renderer on MacOS X like I need for AbiWord (currently, AbiWord text renderer is really buggy on MacOS X).

So I took a deep breath and dug into the code. I'm getting depressed.

First it looks like there is not one true way to render text as they have 2 methods to draw text with 2 different cases that they determine with shouldUseATSU() based on the content of the text run. From what I can say (comments are really sparse), it depends of the Unicode chars to be rendered. But they have a switch back when alwaysUseATSU is set to YES that makes ATSU being used all the time. I wonder if Safari doesn't set it all the time using the "private API". But why? Is using CoreGraphics directly way faster but much more limited? That what I'll try to figure out.

At one point I thought about using CoreGraphics, but in 10.2, the API do not allow to draw non ASCII char, or you have to get CGGlyph, which seems to be uneasy, and the font selection does not seems to be doable from a Cocoa NSFont as there is not method to get a CGFontRef from a NSFont. All the searches on google point to an undocumented method from NSFont, but as always, avoid that is it might break in future releases.

So I had a look at WebKit, and they use WKGetCGFontFromNSFont. Perfect. I look closely and realise that this function is in a damn libWebKitSystemInterface.a binary ! Yes. No API for a much needed feature, and when Apple's open source code actually need it, it is in a damn closed binary library...

Now getting the metrics fast. Same thing. Private function in the binary library.

Why can't Apple release this APIs ? Question about how to do that has been asked for years on various mailing list with Apple engineer always responding the same B.S.. With this they demonstrate that these APIs are usefull, so why do they have to be kept secret? I can't use a binary library like that for AbiWord.

I filed bug 4257530 for that, without any hope.

And years ago, there was an attempt of a lawsuit to Microsoft for the use of unpublished Windows APIs to stiffle the one bit of competition they can't stand for...