static void
get_layout_location (GtkLabel *self,
- int *xp,
- int *yp)
+ float *xp,
+ float *yp)
{
GtkWidget *widget = GTK_WIDGET (self);
const int widget_width = gtk_widget_get_width (widget);
PangoRectangle logical;
float xalign;
int baseline;
- int x, y;
+ float x, y;
g_assert (xp);
g_assert (yp);
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_baseline (widget);
if (baseline != -1)
GtkLabel *self = GTK_LABEL (widget);
GtkLabelSelectionInfo *info;
GtkCssStyle *style;
- int lx, ly;
+ float lx, ly;
int width, height;
GtkCssBoxes boxes;
const char *cluster;
const char *cluster_end;
gboolean inside;
- int lx, ly;
+ float lx, ly;
*index = 0;
int *x,
int *y)
{
- int local_x, local_y;
+ float local_x, local_y;
g_return_if_fail (GTK_IS_LABEL (self));
gtk_label_ensure_layout (self);
get_layout_location (self, &local_x, &local_y);
if (x)
- *x = local_x;
+ *x = (int) local_x;
if (y)
- *y = local_y;
+ *y = (int) local_y;
}
/**