So, I've played with this now. First, I created a test Glade file[1] rendering all the combinations. Then I created a Glade file with the (IMO) correct rendering[2]. The renderings show what combination is rendered and then render it using a trick that guarantees the widgets get assigned their required (top and left) or natural (bottom and right) size. So the top right label for example got assigned its natural width and required height.
Then I created PNG files from those two Glade files[3][4]. Then I noted the differences and started fixing things. In my current state[5], I am pretty close to my ideal rendering as you can see if you look at the differences[6]. And unless someone has any complaints about my idea of correctness, I will be pushing my changes to the master branch soon, after figuring out how to fix the last remaining issue (by either fixing Pango or my reference rendering.) Benjamin 1: http://people.freedesktop.org/~company/stuff/label-fun.ui 2: http://people.freedesktop.org/~company/stuff/label-fun.ref.ui 3: http://people.freedesktop.org/~company/stuff/label-fun.ref.png 4: http://people.freedesktop.org/~company/stuff/label-fun.org.png 5: http://people.freedesktop.org/~company/stuff/label-fun.out.png 6: http://people.freedesktop.org/~company/stuff/label-fun.diff.png On Sun, Apr 10, 2011 at 12:25 AM, Benjamin Otte <o...@gnome.org> wrote: > Hey, > > So this came up while discussing > https://bugzilla.gnome.org/show_bug.cgi?id=647284 and we weren't sure > what the proper answers for all those questions were. So we were > wondering. > We are thinking about GtkLabel size reuqests, in particular about the > width. For ease of discussion, we assume that the font is monospaced, > so we can forget about pixels and only think about characters. The > text set on the label is "12345 1234" (10 characters in 2 words). And > the question is: Given the properties on the left what width should > the label request? Please fill out the table. > > label properties number of > characters label should request > wrap ellipsize width_chars max_width_chars minimum natural > false false -1 -1 ? ? > true false -1 -1 ? ? > false true -1 -1 ? ? > true true -1 -1 ? ? > false false 4 -1 ? ? > true false 4 -1 ? ? > false true 4 -1 ? ? > true true 4 -1 ? ? > false false 8 -1 ? ? > true false 8 -1 ? ? > false true 8 -1 ? ? > true true 8 -1 ? ? > false false 12 -1 ? ? > true false 12 -1 ? ? > false true 12 -1 ? ? > true true 12 -1 ? ? > false false -1 4 ? ? > true false -1 4 ? ? > false true -1 4 ? ? > true true -1 4 ? ? > false false 4 4 ? ? > true false 4 4 ? ? > false true 4 4 ? ? > true true 4 4 ? ? > false false 8 4 ? ? > true false 8 4 ? ? > false true 8 4 ? ? > true true 8 4 ? ? > false false 12 4 ? ? > true false 12 4 ? ? > false true 12 4 ? ? > true true 12 4 ? ? > false false -1 8 ? ? > true false -1 8 ? ? > false true -1 8 ? ? > true true -1 8 ? ? > false false 4 8 ? ? > true false 4 8 ? ? > false true 4 8 ? ? > true true 4 8 ? ? > false false 8 8 ? ? > true false 8 8 ? ? > false true 8 8 ? ? > true true 8 8 ? ? > false false 12 8 ? ? > true false 12 8 ? ? > false true 12 8 ? ? > true true 12 8 ? ? > false false -1 12 ? ? > true false -1 12 ? ? > false true -1 12 ? ? > true true -1 12 ? ? > false false 4 12 ? ? > true false 4 12 ? ? > false true 4 12 ? ? > true true 4 12 ? ? > false false 8 12 ? ? > true false 8 12 ? ? > false true 8 12 ? ? > true true 8 12 ? ? > false false 12 12 ? ? > true false 12 12 ? ? > false true 12 12 ? ? > true true 12 12 ? ? > > > Alternatively, you can describe an algorithm to compute the label and > I will fill out the table for you. But I'm pretty sure you'll get the > algorithm wrong and do something entirely stupid for some weird corner > case. > > Enjoy, > Benjamin > _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list