diff options
author | Felipe Heidrich | 2006-08-03 16:51:07 +0000 |
---|---|---|
committer | Felipe Heidrich | 2006-08-03 16:51:07 +0000 |
commit | 87a273517d8662be0d55be7871a1f3a52f123a80 (patch) | |
tree | 348a0ae114f8331d5f995a4ad15779ea653d53a8 | |
parent | e9ae07fd367d911ee6d4e07d42035b0e3fd629db (diff) | |
download | eclipse.platform.swt-87a273517d8662be0d55be7871a1f3a52f123a80.tar.gz eclipse.platform.swt-87a273517d8662be0d55be7871a1f3a52f123a80.tar.xz eclipse.platform.swt-87a273517d8662be0d55be7871a1f3a52f123a80.zip |
Bug 144765 Layout on Labels generates a size that cuts off characters
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index a97f721953..17630136cf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -135,6 +135,26 @@ public Point computeSize (int wHint, int hHint, boolean changed) { if (fixWrap) { OS.gtk_widget_set_size_request (labelHandle, labelWidth [0], labelHeight [0]); } + if (hHint == SWT.DEFAULT && labelHandle != 0) { + int /*long*/ layout = OS.gtk_label_get_layout (labelHandle); + int /*long*/ context = OS.pango_layout_get_context (layout); + int /*long*/ lang = OS.pango_context_get_language (context); + int /*long*/ font = getFontDescription (); + int /*long*/ metrics = OS.pango_context_get_metrics (context, font, lang); + int ascent = OS.PANGO_PIXELS (OS.pango_font_metrics_get_ascent (metrics)); + int descent = OS.PANGO_PIXELS (OS.pango_font_metrics_get_descent (metrics)); + OS.pango_font_metrics_unref (metrics); + int fontHeight = ascent + descent; + int [] buffer = new int [1]; + OS.g_object_get (labelHandle, OS.ypad, buffer, 0); + fontHeight += 2 * buffer [0]; + if (frameHandle != 0) { + int /*long*/ style = OS.gtk_widget_get_style (frameHandle); + fontHeight += 2 * OS.gtk_style_get_ythickness (style); + fontHeight += 2 * OS.gtk_container_get_border_width (frameHandle); + } + size.y = Math.max (size.y, fontHeight); + } return size; } |