[cairo] cairo/quartz on iPhone

Vladimir Vukicevic vladimir at pobox.com
Fri Mar 7 00:52:04 PST 2008


It turns out that the iPhone's platform services such as CoreGraphics  
are basically identical to the native OSX ones, so I did a bit of  
munging tonight and figured out the incantations [*] that allow cairo  
to build using the iPhone Aspen SDK and to run in the emulator.  Note  
that the emulator is an x86 API-level emulator; while it's possible to  
build for arm, you can't run the code on anything yet.

The Quartz backend works as-is; the only issue there is that it was  
including Carbon.h, when it really should just be including  
CoreGraphics.h.  The bigger issue is that the iPhone does not have  
ATSUI (which is fine -- ATS is being deprecated on OSX overall), so I  
wrote a start of a CGFont backend.  This really should be the main  
backend for Quartz; we can main compat with the old ATSUI font_face  
creation function pretty easily, but the ATSUI internals should go  
away.  I might try to do this before we release 1.6, as I'd like to  
see Quartz become a supported backend in 1.6 and these are really  
general non-iPhone specific issues.

Anyway, the few changes and CGFont backend are pushed to my repository  
in the aspen-sdk branch -- see http://gitweb.freedesktop.org/?p=users/vladimir/cairo;a=shortlog;h=aspen-sdk 
  .  One thing that I'm a little confused by is that my scaled glyph  
metrics getting function seems to need to return glyph metrics  
unscaled by any current text scale -- that seems to be applied by  
cairo itself?  It's not quite what I expected, but I can't find  
anything actually wrong with the results...

Obligatory emulator screenshot: http://people.mozilla.com/~vladimir/misc/aspen-cairo.png

     - Vlad

[*] ./configure --disable-xlib --disable-png --disable-freetype -- 
enable-quartz --enable-cgfont --disable-ps --disable-svg --disable- 
pdf  CPPFLAGS='-isysroot /Developer/Platforms/AspenSimulator.platform/ 
Developer/SDKs/AspenSimulator1.2.sdk' LDFLAGS='-isysroot /Developer/ 

More information about the cairo mailing list