Eyes Above The Waves

Robert O'Callahan. Christian. Repatriate Kiwi. Hacker.

Thursday 5 May 2005

Cairo Progress

In between checking in layout patches and fixing regressions, I've been pressing on with cairo integration. I've done a couple of major things since the last update:

  • Glitz integration. I have Mozilla builds running with Glitz. Unfortunately there are some serious bugs that would make it embarrassing to post a screenshot right now.
  • Drawing text using cairo. Up till now we've been using Xft to draw text. I updated to the latest cairo version and modified our Xft-Pango code to do Xft-cairo-Pango. This means we use Xft and Pango to do glyph selection and text measurement, and use cairo just to render the actual glyphs. This seems to work quite well. Eventually we will use cairo to measure text instead of Xft. On Windows and Mac we can't use Pango (since we want everything we distribute to be MPL-compatible), so we'll have to reuse more of our existing font code.
  • I also fixed various bugs in our cairo glue ... translucent images need premultiplied alpha, some clipping wasn't implemented, etc.


Next I need to fix some of the more glaring rendering bugs and then I'll start experimenting with SVG/HTML integration (but I'll have to get SVG working; it's currently broken in this build).

One issue which I'm putting off is the fact that native GTK2 themes don't work in cairo --- GTK themes want to draw into a GTK rendering context (naturally enough), and we don't have one. Among other things, this means that Firefox menus are transparent, because their background isn't drawn. I think we can rig something up by having nsNativeThemeGTK render to an offscreen pixmap if a GTK rendering context isn't available, then copying that pixmap to the Cairo context. (Ultimately GTK2 itself will render using cairo and hopefully then this issue will have a cleaner solution.) In any case this is not a priority right now.


ffcairo.png


Comments

Grey Hodge
What are some Pango/Windows issues? Can you briefly explain?
Robert O'Callahan
Pango is LGPL only. Mozilla.org has a general policy of only distributing code licensed under the MPL (and possibly other licenses). So Mozilla.org doesn't want to distribute Pango. This isn't a such a problem on Linux, where some version of Pango is probably already installed (although it might be a problem for some older distributions). It's a big problem on Windows where Pango is very unlikely to be already installed.
Caleb
I'd just like to congratulate you for the progress you're making in this area, I can't wait for the next Cairo report :)
AkaXakA
It looks wonderful!
Keep up the good work.
Greg K.
Mac has got to use ATSUI (bug 121540), either via Cairo implementing it or directly from Mozilla.
Martijn Kint
Robert, I'm curious about teh speed od the glitz enabled builds, is it any good compared to the first builds you did with cairo?
Robert O'Callahan
Greg: there is work going on to integrate ATSUI with Cairo.
Martijn: I haven't done any performance work yet.
jmdesp
What I read about your work of porting to Cairo really makes me think that the i18n aspect of it is a really delicate part, that you must not get wrong. The MoFo product are used in many part of the world, in many languages, and have a great support for that. Cairo must not mean a regression.
Make sure you synchronize with the i18n team as much as needed, it must not be an afterthought.
Do you about Sila ? Even if the project stopped, it included interesting change to mozilla GFX to enable powerful mechanism to support really complex scripts :
http://sila.mozdev.org/
Robert O'Callahan
Owen Taylor is working on cairo, and he wrote Pango which is a really strong i18n library, so i18n needs are being taken care of. My current cairo code uses Pango so i18n is probably already at least as good as what's on the trunk.
Jungshik Shin
Will Cairo on Windows use Uniscribe or Pango ported to Windows? (see bug 218887, bug 157967)
Pango is not an I18N library per se but a layout library with a strong I18N support (including complex script support) that is roughly on par with Uniscribe on Windows and ATSUI on Mac OS X.
Robert O'Callahan
I don't know. We certainly could use Uniscribe with cairo if we wanted to. IIRC we can't rely on Uniscribe 100% because we don't want to redistribute it and some Windows boxes don't have it. We could port our current Windows font code over for use with cairo, if necessary