Friday, 6 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


11 comments:

  1. What are some Pango/Windows issues? Can you briefly explain?

    ReplyDelete
  2. Robert O'Callahan6 May 2005 11:17

    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.

    ReplyDelete
  3. 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 :)

    ReplyDelete
  4. It looks wonderful!
    Keep up the good work.

    ReplyDelete
  5. Mac has got to use ATSUI (bug 121540), either via Cairo implementing it or directly from Mozilla.

    ReplyDelete
  6. Martijn Kint7 May 2005 11:31

    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?

    ReplyDelete
  7. Robert O'Callahan7 May 2005 22:16

    Greg: there is work going on to integrate ATSUI with Cairo.
    Martijn: I haven't done any performance work yet.

    ReplyDelete
  8. 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/

    ReplyDelete
  9. Robert O'Callahan10 May 2005 23:34

    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.

    ReplyDelete
  10. Jungshik Shin18 May 2005 14:33

    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.

    ReplyDelete
  11. Robert O'Callahan19 May 2005 02:55

    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

    ReplyDelete