Re: [Patch] unify wrapped label creation

Hi Peter!

Am 26.01.20 21:45 schrieb(en) Peter Bloomfield:
After reading the GtkAlign enum documentation[0] and the GtkLabel::xalign property documentation[1], I'm inclined to 
believe that the best "halign" choice for a GtkLabel is the default GTK_ALIGN_FILL. When we use 
GTK_ALIGN_START (or occasionally GTK_ALIGN_END), the label widget may not fill all the space allocated to it; that 
doesn't seem to be a problem for me, but it would presumably look bad if someone set different backgrounds for the 
GtkLabel and whatever widget contains it.

If I'm right (and I recognize a substantial probability that I'm wrong!-), we should just use the "xalign" 
property to make sure that the text is flush left (or occasionally flush right) in the space allocated to the widget.

Does that make any sense?

Yes, you're right, it does…  Actually it's easy to fix with the patch – just remove line 934 
“gtk_widget_set_halign(label, GTK_ALIGN_START);” in misc.c!

BTW: Other parts of the Gtklabel documentation mention using halign, and not xalign, to " set the alignment of the label as a 
whole" (see the section "Text layout" and the entry for gtk_label_set_justify), but those comments predate 
"xalign", and I'm guessing they're just out of date.

I agree – the xalign property has been introduced with Gtk+ 3.16.  The doc for 3.22.30 (Ubuntu 18.04 LTS) 
says “The xalign property determines the horizontal aligment of the label text inside the labels size 
allocation. Compare this to ‘halign’, which determines how the labels size allocation is positioned in the 
space available for the label.”

Thus, yes, we should have GTK_ALIGN_FILL for halign and 0.0F for xalign, IMHO…


Attachment: pgpVS4w1Km7p_.pgp
Description: PGP signature

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