* @label: the label
* @existing_layout: %NULL or an existing layout already in use.
* @width: the width to measure with in pango units, or -1 for infinite
- * @height: the height to measure with in pango units, or -1 for infinite
*
* Gets a layout that can be used for measuring sizes. The returned
* layout will be identical to the label's layout except for the
static PangoLayout *
gtk_label_get_measuring_layout (GtkLabel * label,
PangoLayout *existing_layout,
- int width,
- int height)
+ int width)
{
GtkLabelPrivate *priv = label->priv;
PangoRectangle rect;
if (existing_layout != priv->layout)
{
pango_layout_set_width (existing_layout, width);
- pango_layout_set_height (existing_layout, height);
return existing_layout;
}
gtk_label_ensure_layout (label);
- if (pango_layout_get_width (priv->layout) == width &&
- pango_layout_get_height (priv->layout) == height)
+ if (pango_layout_get_width (priv->layout) == width)
{
g_object_ref (priv->layout);
return priv->layout;
{
g_object_ref (priv->layout);
pango_layout_set_width (priv->layout, width);
- pango_layout_set_height (priv->layout, height);
return priv->layout;
}
*/
pango_layout_get_extents (priv->layout, NULL, &rect);
if ((width == -1 || rect.width <= width) &&
- (height == -1 || rect.height <= height) &&
!pango_layout_is_wrapped (priv->layout) &&
!pango_layout_is_ellipsized (priv->layout))
{
copy = pango_layout_copy (priv->layout);
pango_layout_set_width (copy, width);
- pango_layout_set_height (copy, height);
return copy;
}
const gdouble dy = matrix->xy; /* sin (M_PI * angle / 180) */
pango_layout_set_width (priv->layout, -1);
- pango_layout_set_height (priv->layout, -1);
pango_layout_get_pixel_extents (priv->layout, NULL, &logical);
if (fabs (dy) < 0.01)
else
{
pango_layout_set_width (priv->layout, width * PANGO_SCALE);
- pango_layout_set_height (priv->layout, priv->ellipsize ? height * PANGO_SCALE : -1);
}
}
else
{
pango_layout_set_width (priv->layout, -1);
- pango_layout_set_height (priv->layout, -1);
}
}
gint *minimum_size,
gint *natural_size)
{
- GtkLabelPrivate *priv = label->priv;
PangoLayout *layout;
gint text_height;
- layout = gtk_label_get_measuring_layout (label, NULL, allocation * PANGO_SCALE, -1);
+ layout = gtk_label_get_measuring_layout (label, NULL, allocation * PANGO_SCALE);
pango_layout_get_pixel_size (layout, NULL, &text_height);
*minimum_size = text_height;
if (natural_size)
- {
- if (priv->ellipsize && priv->wrap)
- {
- layout = gtk_label_get_measuring_layout (label, layout, allocation * PANGO_SCALE, G_MAXINT);
- pango_layout_get_pixel_size (layout, NULL, &text_height);
- }
-
- *natural_size = text_height;
- }
+ *natural_size = text_height;
g_object_unref (layout);
}
*/
/* Start off with the pixel extents of an as-wide-as-possible layout */
- layout = gtk_label_get_measuring_layout (label, NULL, -1, -1);
+ layout = gtk_label_get_measuring_layout (label, NULL, -1);
pango_layout_get_extents (layout, NULL, natural);
natural->x = natural->y = 0;
if (priv->ellipsize || priv->wrap)
{
/* a layout with width 0 will be as small as humanly possible */
- layout = gtk_label_get_measuring_layout (label, layout, 0, -1);
+ layout = gtk_label_get_measuring_layout (label, layout, 0);
pango_layout_get_extents (layout, NULL, required);
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">A
-…</property>
+ <property name="label" translatable="yes">…</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
</attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="width_chars">4</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">A
-…</property>
+ <property name="label" translatable="yes">…</property>
<property name="max_width_chars">4</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="max_width_chars">4</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="width_chars">4</property>
<property name="max_width_chars">4</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="width_chars">4</property>
<property name="max_width_chars">4</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<property name="max_width_chars">4</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<property name="max_width_chars">4</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">A
-…</property>
+ <property name="label" translatable="yes">…</property>
<property name="max_width_chars">8</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="max_width_chars">8</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="width_chars">4</property>
<property name="max_width_chars">8</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">4</property>
<property name="max_width_chars">8</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<property name="max_width_chars">8</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<property name="max_width_chars">8</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">A
-…</property>
+ <property name="label" translatable="yes">…</property>
<property name="max_width_chars">12</property>
<attributes>
<attribute name="font-desc" value="Monospace"/>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCD
-ABCD</property>
+ <property name="label" translatable="yes">ABC…</property>
<property name="width_chars">4</property>
<property name="max_width_chars">12</property>
<attributes>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">ABCDE
-ABCD</property>
+ <property name="label" translatable="yes">ABCDE A…</property>
<property name="width_chars">8</property>
<property name="max_width_chars">12</property>
<attributes>