[gtk/wip/otte/inscription: 3/5] inscription: Do not try to align layouts that have a proper width set
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/inscription: 3/5] inscription: Do not try to align layouts that have a proper width set
- Date: Mon, 13 Jun 2022 03:36:21 +0000 (UTC)
commit 626a817cad2209c6ef4c0f6416fb5bf862aa5e5a
Author: Benjamin Otte <otte redhat com>
Date: Mon Jun 13 04:53:35 2022 +0200
inscription: Do not try to align layouts that have a proper width set
Pango knows where to put the text.
gtk/gtkinscription.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c
index 5f13063fb6..a06b78b30b 100644
--- a/gtk/gtkinscription.c
+++ b/gtk/gtkinscription.c
@@ -424,7 +424,10 @@ gtk_inscription_get_layout_location (GtkInscription *self,
xalign = 1.0 - xalign;
pango_layout_get_pixel_extents (self->layout, NULL, &logical);
- x = floor ((xalign * (widget_width - logical.width)) - logical.x);
+ if (pango_layout_get_width (self->layout) > 0)
+ x = 0.f;
+ else
+ x = floor ((xalign * (widget_width - logical.width)) - logical.x);
baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline != -1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]