From eea7bf93ada2a57fad1dac3e5233f703d1af02ff Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 9 Oct 2012 21:56:08 +0200 Subject: Set frame size to the size of contents --- src/layout.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/layout.c b/src/layout.c index ae7a5e8..cef270d 100644 --- a/src/layout.c +++ b/src/layout.c @@ -56,6 +56,7 @@ static void layout_subframe(struct frame *fr, double w, double h, double child_w, child_h; double offs_x, offs_y; PangoFontDescription *fontdesc; + PangoRectangle extents; child = fr->rendering_order[i]; @@ -89,6 +90,10 @@ static void layout_subframe(struct frame *fr, double w, double h, pango_layout_set_font_description(child->pl, fontdesc); pango_font_description_free(fontdesc); + pango_layout_get_extents(child->pl, NULL, &extents); + child_w = extents.width / PANGO_SCALE; + child_h = extents.height / PANGO_SCALE; + /* Now, apply the minimum size if given */ if ( child->lop.min_w > 0.0 ) { if ( child_w < child->lop.min_w ) { -- cgit v1.2.3