Mac OS X Porting - Canvas

From Apache OpenOffice Wiki
Jump to: navigation, search


  • Mox Soini: Mox
  • Thorsten Behrens (thb)


The current rendering framework in (OOo) is VCL. It is very Windows-oriented API that is hard to port to other platforms. Despite this, there are several ports available, including Unix/X11, Windows and Native Mac OS X port using Cocoa. Another big problem of VCL is that also the internals of the VCL are used from many places in the OOo code.

The future rendering framework in OOo is UNO XCanvas rendering framework. The benefits include a better designed API (easier to port and use) and a stronger isolation of the API from the rest of OOo.

Currently, the XCanvas implementation has been jump-started by directing text rendering back to VCL.

The location of the Drawing layer. Click on image for full view

XCanvas is part of bigger module in OOo, called Drawing Layer. There is initiative to improve the whole module: Drawing Layer/Drawing Primitives

For XCanvas information, see presentations at OOoCon 2006 (PDF, ODP, video/ogg) and OOoCon 2005 (PDF)

Of the OOo applications using VCL, currently (September 2006) OOo Impress slideshow has been converted to XCanvas, with prototypes working in Draw and Impress. Future work will include converting Calc and Writer.

NOTE: this work does not address the problem with native widgets and UI layout, only rendering. The UI Layout is discussed in UI Layout and details are in VCL UI Rework.

Roadmap for Canvas in Mac OS X

Short term: use the VCL implementation of XCanvas.

Long term: create a native implementation of XCanvas. There are two alternative ways to complete this:

  1. Create complete, non-VCL, canvas implementation in OOo (like the Windows implementation, not worked on in Mac OS X)
  2. Create implementation based on Cairo -library (like the Linux implementation, this is the currently chosen alternative for Mac OS X)

The benefits of cairo-based implementation include:

  • Less code in OOo, more shared code with other open source programs
  • Cairo has been already ported to Mac OS X, no need to duplicate that effort for OOo only.
  • Mozilla is using this approach (in Gecko 1.9 / Firefox 3.0) for all of their platforms (The Thebes API, which is a light C++ API on top of Cairo API in C)
  • GTK/Gnome is using this approach for all of their platforms (The new Canvas-widget & rendering, based on Cairo)


As of Apr 2008, the Quartz cairo canvas for OOo Mac OS X is implemented, but not fully working. All the text is not visible, although actual rendering works ok. There's also a crash when closing down Canvas.


  • Cairo canvas code documentation added
  • Quartz backend added to Cairo Canvas (issue 69066)


Now there are cairo-based Canvas backends for Unix/X11, Windows and Mac/Quartz. The text rendering, however, is always directed back to VCL. To take the full advantage of cairo library, and it's support for cross-platform text layout and rendering, the XCanvasFont and XTextLayout interfaces need to be implemented "natively" with cairo.


  • Create cross-platform cairo-based text rendering for cairo canvas backend (issue 88613)


The APIs that are involved are (XCanvas, Cairo, Quartz 2D, and a little bit of Cocoa)

Personal tools