Bug 572943 - [gtk] First Radio Button is truncated with Gridlayout

- Problem is not with the GridLayout but how the button calculates its
size. The button size calculation seems to be incorrect when the
selection of the radio button is active before setting of the text

- Solution: Enforce selection of the radio button until after the font
has been set. Workaround is similar to Combo.setFontDescription

Change-Id: I62cb20ddaf60dd321ed9046b1d8835612be34ef0
Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/179684
Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 96ef0ae..627fdd6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -1000,7 +1000,20 @@
 		return;
 	} else {
 		super.setFontDescription (fontDesc);
-		if (labelHandle != 0) setFontDescription (labelHandle, fontDesc);
+
+		if (GTK.GTK4) {
+			if (labelHandle != 0) setFontDescription(labelHandle, fontDesc);
+		} else {
+			/*
+			 * GTK3 Workaround for bug which causes incorrect size
+			 * calculation when the button (radio/check) is set active
+			 * before setting font description.
+			 */
+			boolean selected = getSelection();
+			if (selected) setSelection(!selected);
+			if (labelHandle != 0) setFontDescription(labelHandle, fontDesc);
+			setSelection(selected);
+		}
 	}
 }