GNOME Bugzilla – Bug 765715
halign seems to be ignored if label is word wrapped
Last modified: 2018-03-26 15:54:16 UTC
If I set set a label's halign property to something else than GTK_ALIGN_FILL (e.g. GTK_ALIGN_START) and enable word wrapping on the label and set the text to something long enough that it is actually wrapped, then the label is not aligned according to the halign. Steps to reproduce: 1. Create a GtkLabel 2. Set the halign property to GTK_ALIGN_START 3. Set the wrap property to True 4. Leave the wrap-mode property to the default pango.WRAP_WORD (bug does not apply to pango.WRAP_CHAR) 5. Set the label text to something long enough to cause wrapping Result: Label is aligned like halign was set to GTK_ALIGN_FILL. Expected result: Label is aligned to the left. Using the deprecated GtkAlignment with xalign = 0 works as expected.
A screenshot might help to make your point clear; so far I don't believe that there is a bug. The interaction between xalign/halign and justify can be confusing. GtkLabel::xalign is not deprecated because it is still needed for cases like the one you describe.
Created attachment 326931 [details] halign set to GTK_ALIGN_START and text is word wrapped
Created attachment 326932 [details] xalign set to GTK_ALIGN_START and word wrapped, but text not long enough to actually wrap.
Created attachment 326933 [details] xalign set to 0 produces the expected result
> --- Comment #1 from Matthias Clasen <mclasen@redhat.com> --- > A screenshot might help to make your point clear; so far I don't believe that > there is a bug. The interaction between xalign/halign and justify can be > confusing. Sure, I added screenshots of the different behaviours. > GtkLabel::xalign is not deprecated because it is still needed for cases like > the one you describe. The GTK+ 3 Reference Manual on GtkAlignment [1] says that the xalign property is deprecated and halign should be used instead. This was why I thought that halign would replace xalign and should have the same behaviour. But now I see that the GtkLabel::xalign does not have the comment about being deprecated. But at least when using Glade there seems to be no way to set the xalign without a warning triangle being displayed, warning about the deprecation of the property. Also, I don't see why halign should behave this way. [1] https://developer.gnome.org/gtk3/unstable/GtkAlignment.html
I'm going to move this bug to glade, since the real problem here is that GtkLabel::xalign is not offered.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glade/issues/236.