Re: Setting Font Faces and Sizes



On Sat, 2007-01-06 at 16:22 -0500, muppet wrote:

Yeah.  We're using newSVPangoFontDescription_copy in
Gtk2::Style::font_desc, so we actually hand out a copy.  I think  
that's
not necessary.  Proposed patch attached.

Looks okay, but i'm worried about compatibility.  The current code  
goes back a long, long way.  Aside from renumbering the switch  
statement in Nov '03, there's a bugfix:

That worried me too.  There might be code out there that relies on
getting a copy.  People might store the object somewhere and then try to
use it after the style has been destroyed which most probably leads to
havoc.

Copy the font_desc, not &font_desc
http://gtk2-perl.cvs.sourceforge.net/gtk2-perl/gtk2-perl-xs/Gtk2/xs/ 
GtkStyle.xs?r1=1.5&r2=1.6

And the use of newSVPangoFontDescription_copy() goes all the way back  
to version 1.1, imported from the last non-cvs snapshot in April of  
'03.  The comment, "/* FIXME: is it correct to _copy these */" is  
intact in that first revision, as well.  :-/

Looks like I changed the color accessors to not use _copy.  I don't know
why I didn't change font_desc as well. :-/

Not sure.  Not sure how to test it for compatibility, either.  I can  
come up with arguments either way as to whether it should or  
shouldn't hand out a copy...

I think handing out the real thing would make more sense since
otherwise, modifications done to the object have no effect on the style.
But the compatibility concerns you raised and the existence of a
workaround (modify_font) seem to be reason enough not to change the
current behavior.

-- 
Bye,
-Torsten




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