[cairo] Pango AttributesList Question

Owen Taylor otaylor at redhat.com
Tue Sep 7 18:28:01 PDT 2010

On Fri, 2010-09-03 at 13:12 +1000, Andrew Cowie wrote:
> On Thu, 2010-09-02 at 16:48 -0400, Behdad Esfahbod wrote:
> > I don't know!  I *think* it is relevant when you have multiple attributes of
> > the same kind starting at the same position.  The later ones "win" I guess.
> I think so?
> It's been a few months, but I went through a phase where I concluded
> that putting down an PangoAttribute with a FontDescription _after_ you'd
> used some other attributes would wipe out the (italics say) previous
> ones. Obviously FontDescriptionAttribute is "heavy" (I don't have any
> problem with any of this) but it was still a surprise the first time
> that order mattered.

 * Setting a PangoFontDescription is a shorthand for setting

    family, style, weight, variant, size

 * So you had two things setting the style - the style attribute
   (italics) and the FontDescription attribute. One of them had to

 * The second one set won. Is that surprising?

To me its very expected. Anything else would be surprising.

- Owen

  I'm actually simplifying - 

  pango_font_description_parse("sans-serif 10") gives, as
  described above:
  family=sans-serif, style=normal, weight=normal, variant=normal, size=10

  But it's also possible to have font descriptions with 
  the style unset, with, e.g.:

   desc = pango_font_description_new();
   pango_font_description_set_family(desc, "sans-serif");

  and if you put that in a PangoAttribute it won't override
  the italic style attribte.

More information about the cairo mailing list