Compare commits

...

2 Commits

Author SHA1 Message Date
Matthias Clasen
e6fa2812a2 reftests: Fix one reftest
The xalign property of GtkLabel defaults to 0.5,
meaning that the contents will be centered, which
is not what GtkInscription does.
2023-08-02 15:05:37 +00:00
Matthias Clasen
da17e04be3 label: Another tweak to wrapping handling
This fixes a few reftests that were failing after
the previous change because they ended up with x == -1.
2023-08-02 15:05:37 +00:00
2 changed files with 3 additions and 3 deletions

View File

@@ -1333,10 +1333,9 @@ get_layout_location (GtkLabel *self,
xalign = 1.0 - xalign;
pango_layout_get_pixel_extents (self->layout, NULL, &logical);
if (pango_layout_get_width (self->layout) > 0)
x = floor ((xalign * (widget_width - logical.width)) - logical.x);
if (x < 0)
x = 0.f;
else
x = floor ((xalign * (widget_width - logical.width)) - logical.x);
baseline = gtk_widget_get_baseline (widget);
if (baseline != -1)

View File

@@ -8,6 +8,7 @@
<object class="GtkLabel">
<property name="use-markup">1</property>
<property name="wrap">1</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Text sizes: &lt;span size="xx-small"&gt;tiny &lt;/span&gt;&lt;span size="x-small"&gt;very small &lt;/span&gt;&lt;span size="small"&gt;small &lt;/span&gt;&lt;span size="medium"&gt;normal &lt;/span&gt;&lt;span size="large"&gt;large &lt;/span&gt;&lt;span size="x-large"&gt;very large &lt;/span&gt;&lt;span size="xx-large"&gt;huge&lt;/span&gt;
Text styles: &lt;span style="normal"&gt;Normal&lt;/span&gt; &lt;span style="italic"&gt;Italic&lt;/span&gt; &lt;span style="oblique"&gt;Olique&lt;/span&gt;
Text weights: &lt;span weight="thin"&gt;thin&lt;/span&gt; &lt;span weight="light"&gt;light&lt;/span&gt; &lt;span weight="normal"&gt;normal&lt;/span&gt; &lt;span weight="bold"&gt;bold&lt;/span&gt; &lt;span weight="ultraheavy"&gt;ultraheavy&lt;/span&gt;