Re: pango_layout_set_text doesn't drop old markup attributes



On Fri, 2008-02-15 at 10:31 +0100, Theo Veenker wrote:
> Hi,
> 
> When I call pango_layout_set_markup(layout, "<b>foo</b>...") on a
> layout object and then later call pango_layout_set_text() on the
> same layout object the text changes, but the markup is still there.
> 
> I suppose this is unintentional. Can I kill the markup without
> recreating the layout object?

This is in fact intentional, though surprising at first.
pango_layout_set_markup() docs refer to
pango_layout_set_markup_with_accel() which clearly says it "[r]eplaces
the current text and attribute list."  So if you change text later, it's
up to you to clear attribute list.

If pango_layout_set_text() was changed to clear attribute list, that
would break code that first sets attributes on the layout then sets
text.

I'll add a note to the docs for set_text() though.


> TIA.
> 
> Theo

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]