[cairo] Basic cairomm questions

Jonathon Jongsma jonathon at quotidian.org
Fri Aug 8 12:28:05 PDT 2008

Hello Ian, and welcome!

Ian Britten wrote:
> Hi all,
> I'm new to Cairo (Looks pretty good though!), and had a couple of
> (basic) questions, mostly related to cairomm (And PDF, since
> that's where I'm starting).
> - Is this an appropriate place for cairomm questions?  I found the
>    documentation for it
>    (http://www.cairographics.org/documentation/cairomm/reference/)
>    but couldn't seem to find any sort of project page for it.

yes, this is an appropriate place. If you are using cairomm together 
with gtkmm, the gtkmm list is also an appropriate place to ask.

> - What's the relationship between cairo and cairomm (Other than
>    the obvious C++ wrapping)?  Is it maintained by the same people
>    at the same time as cairo, or is it some sort of unofficial
>    add-on, which might be lagging behind, abandoned someday, etc?
>    [ Asked another way I guess - If I'm a C++ developer, why
>      *wouldn't* I use cairomm?  What long-term risk/concern would
>      I introduce to my project by using it? ]

cairomm is not maintained by the same people that develop cairo. It is 
usually slightly behind the base cairo library but not by much. You do 
not have to worry about it being abandoned as it is a dependency of 
gtkmm (which has been stable and actively developed for many years) and 
is maintained by the same people. Since you asked, here are a couple 
reasons you might not want to use cairomm: the bindings are not 100% 
complete at the moment (e.g. some of the more advanced text / glyph 
API), though this is not really a problem in practice since you always 
have access to the underlying C cairo objects and can use the C API 
directly anytime you want to. The other reason you might not want to use 
cairomm is if you value raw speed above all else. Using exceptions, 
smart pointers, etc. will obviously add a very small amount of runtime 
overhead. In most cases, the overhead will be negligible, but in some 
cases it might matter (which might translate into: if you're an 
application developer, use cairomm, if you're a library developer, use 

> - If cairo and cairomm are "together":
>    - Should there be a link somewhere from the Cairo page to the
>      cairomm docs (at least).  Sorry if I overlooked it.
>    - Are they sync'd/released together, or do they maintain their
>      own independent version numbers?

The release management is separate and the version numbers are separate, 
though obviously the minor release numbers will match (e.g. cairomm 
1.6.x wraps cairo 1.6.x, etc). There will be variations in the micro 
versions between cairomm and cairo, however. Because cairomm is only a 
binding of cairo, when the base library fixes internal bugs and makes a 
new release, the binding generally does not need to be updated, so we 
don't always make new releases when cairo does.

> - What strategy does cairo(mm) use for error handling?  As a
>    specific example, if an invalid path/filename is passed to
>    the PdfSurface constructor (such that it can't create the
>    requested file), how to I know that?  Exceptions?  Error
>    numbers somewhere (Like errno)?  Inference? (ie: I get a NULL
>    back, and guess what the problem might have been)  Other?

In general, we try to model all error codes as exceptions.

> - As a graphics library, I realize encodings and Unicode aren't
>    really a big concern to Cairo, but is there any definitive
>    approach to this?  Again, using the filename passed to the
>    PdfSurface constructor, what encoding/codepage is that
>    expected to be in?  Current runtime?  UTF8?  ISO-8859-1?
>    [ All our text handling is in Unicode, so I'll need to
>      address this issue anywhere I'm interfacing with relevant
>      Cairo code. ]

I believe it's the current locale encoding, but I'm sure somebody will 
correct me if I'm wrong.

I hope that helps.


More information about the cairo mailing list