Chris' Cairo Blog

March 10, 2010

Pango + cairo = Nice Labels!

Filed under: What I am working on — thorgch @ 12:33 pm

If you aren’t already aware, the folks (Travis Griggs and his co-workers) at Cincom have developed language bindings for Pango. The Pango website describes Pango as…a C library for laying out and rendering text. The description also goes on to say…integrating Pango with cairo provides a complete solution with high quality text handling and graphics rendering.      

Since my machine animation overviews usually need a lot of labels (some active and some passive), I decided that it was time for a new widget…..the PangoMarkupLabelView (The PangoMarkupLabelView’s model is a CairoTransformWrapper on a PangoMarkupLabel). The reason I called it a markup label is because Pango offers a markup capability as part of its library. I really liked this markup interface since it helped me simplify my widget. The view’s widget spec and associated GUIPainter slices help to configure the markup string. In turn the markup string then plays a central role in how Pango lays out and renders the string on to the cairo context. A nice description of the markup language can be found here.      

Like the CairoPNGImageView, I also wanted my labels to take advantage of all the functions that my transform wrapper provide. If you have watched any of the videos about the transform wrapper, then you probably know what I am referring to.      

Here’s a few pictures and a video of the label in action.      

PangoMarkupLabel Image 1

An example of a PangoMarkupLabel

 Yes…the “glassy effect” has been done to death, but I couldn’t resist seeing if I could make an active widget that had a bit of it. I suppose there is a place for it, but it’s unlikely you would ever see it used on my animation overviews.      

PangoMarkupLabel Image 2

An example of using the labels to build a component

 The only point to this video is to show that the labels can also be active. All you’re going to see is a ticking clock……exciting!  


Before I end this post, I figured I should give an update about the progress of putting my Cairo Graphics Kit up on the Cincom public store. As it stands, I am waiting to hear back from our legal department. I am requesting that we use a GNU LGPL license to cover the work (same license that cairo and Pango use).      

I would like to think that all this work is free to give away to the world. The reality however is that the company I work for has the final say since they are paying me to do this work. Fortunately, my VP does see the advantage of putting this in the public domain in the hope that others help to contribute to it. Hopefully our lawyers see it the same way.



  1. Nice work. If you will end like Sun then choose LGPL, otherwise choose MIT.


    Comment by ABC — March 10, 2010 @ 11:38 pm | Reply

    • Hopefully we don’t end up like Sun….Luckily software isn’t our main business, selling semiconductor manufacturing equipment is.

      Comment by thorgch — March 11, 2010 @ 10:57 am | Reply

  2. Wow Chris. The clock there is totally cool. This stuff is addictively fun, huh?

    Comment by Travis Griggs — March 10, 2010 @ 11:43 pm | Reply

    • Very addictive, but also very rewarding. Most of all though, our VS C# guys are finally envious… 🙂

      Comment by thorgch — March 11, 2010 @ 10:46 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: