Jump to navigation

Poupou's Corner of the Web

Looking for perfect security? Try a wireless brick.
Otherwise you may find some unperfect stuff here...


New Build Options for Libgdiplus

It's a little known fact but, since Cairo 1.4 was released, libgdiplus no more requires any patch (to Cairo) in order to work properly. Well that's 99.9% true as the only required changes/patches are related to embedding Cairo inside libgdiplus.

So, if you have Cairo 1.4.x installed, it is now possible to build libgdiplus using your distro libcairo, like this:

% ./autogen.sh --with-cairo=system ... Configuration summary * Installation prefix = /usr/local * Cairo = system * Text = cairo * EXIF tags = yes * Codecs supported: ...

The resulting library (about 2.5 times smaller and a lot faster to compile) pass all System.Drawing's unit tests. Still this isn't, at the moment, a supported option and the minimum Cairo version (1.4 right now) is subject to change. E.g. we may end up patching Cairo again (hopefully not) and/or Cairo 1.6 roadmap includes some stuff [77937] [81374] that we might require in the future and, who knows, maybe someone will even implement the documented, but missing, cairo_stroke_to_path. Anyway please feel free to test, and report bugs, for this new configuration.

So why adding this option if it's not supported ? because it's required to start working with Pango to render (measure and draw) text.

So if you have Pango 1.10 or later (and that's subject to change too) you can try:

% ./autogen.sh --with-cairo=system --with-pango ... Configuration summary * Installation prefix = /usr/local * Cairo = system * Text = pango * EXIF tags = yes * Codecs supported: ...

That one is totally unsupported and, at this stage, I don't even want to know about bugs - unless you provide a patch to fix them (in part because the current code use the high-level API, PangoLayout and some of them missing features may requires us to use the low-level API soon.

Unit tests wise this Pango-enabled build does fine, only three System.Drawing tests are failing (out of 1759). However I fear this indicates more a lack of tests than an almost-total success.

Mandatory screenshots

Our own logic rendered with Cairo

Pango's logic rendered with PangoCairo

Known issues

  • Textbox performance is really bad, because it measure every character one-by-one (and setting up a Pango Layout is more expansive than our old logic);
  • Text selection (Textbox, ComboBox) and multilines don't render correctly (didn't look why);
  • and probably a lot more ;-)

8/9/2007 09:36:03 | Comments

The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of my employer.