Project: SWT
Bug 393856 Consider using pango_layout_get_pixel_size
Reported: 2012-11-08 06:52:15 | Status: resolved fixed

Currently we do: OS.pango_layout_get_size (layout, w, h); int width = OS.PANGO_PIXELS (w [0]) ; int height = OS.PANGO_PIXELS (h [0]); If we use pango_layout_get_pixel_size we should be able to do just: int width, height; OS.pango_layout_get_pixel_size(layout, width, height); pango_layout_get_pixel_size uses ceil/floor on the values, while PANGO_PIXELS is shifting so we might end up with some rounding differences, though I haven't experienced anything problematic with my tests. Silenio, what do you think ?

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java