[cairo] Underlining text, etc?

Ian Britten britten at caris.com
Fri Oct 2 12:21:21 PDT 2009


Jeffrey Stedfast wrote:

> Take a look at FreeType2's underline_position and underline_thickness
> attributes on the FT_Face you're using to render the glyphs. Once you
> know those values, it's pretty trivial to render underlines.

Thanks.  We already use this in our main (non-Cairo) rendering path.

However, I now see that where I'm trying to patch Cairo in, I may not
have the info I need (Critically, the next/previous character).  I'm
in a "draw this single character at this position" hook, so I'm not
sure how I'll figure out how to make the points for the line, etc... :(
[ Which is kindof why I was hoping Cairo automagically handled it! :) ]

Irregardless, I'm still open to any suggestions about how to how to
best use Cairo to do this.  For example, should I draw each underline
stroke after each character, or should I draw all the underlines
separately after the characters?  What if the text and strikeout are
partially transparent - Shouldn't the result have one homogeneous
alpha?  Is this somewhere I should maybe make use of a Cairo 'group'?
I haven't used them anywhere yet ...

Anyways, thanks for the feedback, and for any suggestions!
Ian



More information about the cairo mailing list