Re: pango layout in irregular (non-rectangular) bounding shape
- From: august <august alien mur at>
- To: Alissa Sabre <alissa_sabre yahoo co jp>
- Cc: gtk-i18n-list gnome org
- Subject: Re: pango layout in irregular (non-rectangular) bounding shape
- Date: Mon, 2 Mar 2009 15:43:35 +0100
> august,
>
> > I
> > can already render stuff to screen and bound a text segment by width
> > and height
>
> I guess you tried PangoLayout and friends.
>
> > how to render text within a non-rectangular bounding shape?
>
> > Can someone point me in the right direction?
>
> If I were you, I'd be using PangoItem, PangoGlyphString, and friends.
> They are lower layer interface to pango, and you need to write more
> codes than using PangoLayout, but it gives you better control over
> layout. (There may be some easier ways if you only needs fill texts
> ina non rectangular area, but I don't know.)
>
> The following outlines what you need to do:
>
> (1) Call pango_itemize() once for your text,
> (2) Call pango_break() for your entire text,
> (3) Call pango_shape() for each PangoItem you got,
> (4) Fold the text into lines, scanning the list of PangoItems, calling
> pango_glyph_string_get_width() for each PangoGlyphString you got,
> also breaking several PangoItem in a middle, referring to
> PangoLogAttr array you got (This will be the most complicated step),
> (5) Either call pango_reorder_items() for each folded line and somehow
> refrect the results to your list of PangoGlyphString (or does an
> equivalent processing manually as suggested by pango document...), and
> (6) Call pango_cairo_show_glyph_string() for each PangoGlyphString,
> moving the cairo current point appropriately.
>
> Hope this helps,
> Alissa
Alissa,
thanks so much for taking the time to outline all of this. I am
still learning the pango api and this helps.
-august.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]