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:
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.
- 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.
Comments
Keep up the good work.
Martijn: I haven't done any performance work yet.
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/
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.