Community
Participate
Working Groups
The function gtk_widget_override_font() is deprecated since GTK3.16. This is a dynamic function. https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-font
New Gerrit change created: https://git.eclipse.org/r/136117
*** Bug 496876 has been marked as a duplicate of this bug. ***
*** Bug 544084 has been marked as a duplicate of this bug. ***
(In reply to Eclipse Genie from comment #1) > New Gerrit change created: https://git.eclipse.org/r/136117 This patch makes setting font entirely through CSS and adds the CSS caching mechanism for all widgets. It cannot be merged as setting font through CSS causes an issue where the size of the widgets does not get updated immediately after a font change. This happens for widgets with a container wrapped around the text. (i.e. Button, Combo, DateTime, List, TabFolder, Table/Tree, etc). From some investigation, this is to due to that widgets requires many iterations of the gtk_main loop before size gets updated correctly. One possible workaround is to explicitly calculate the size in SWT after setting font to force the size to be correct immediately (patchset 9), but this is too hacky and causes artifacts to be shown on GTK3 in some cases.
I upgraded to Fedora 30 (using GTK 3.24.8 and still see same error and new ones, when starting with broadway as backend): (Eclipse:8357): Pango-CRITICAL **: 09:26:45.562: pango_font_description_set_size: assertion 'size >= 0' failed *** BUG *** In pixman_region32_init_rect: Invalid rectangle passed Set a breakpoint on '_pixman_log_error' to debug
For this one, on Braodway specifically, text isn't shown while it's shown on plain GTK. Do you think a fix should be provided to Broadway and it's really and purely a SWT bug?
(In reply to Mickael Istria from comment #6) > For this one, on Braodway specifically, text isn't shown while it's shown on > plain GTK. Do you think a fix should be provided to Broadway and it's really > and purely a SWT bug? The affected widgets (Labels, mostly) use Pango for their text rendering and I believe the bug is either: 1) in Pango itself or 2) in the way SWT is using Pango. (In reply to Mickael Istria from comment #5) > I upgraded to Fedora 30 (using GTK 3.24.8 and still see same error and new > ones, when starting with broadway as backend): > > (Eclipse:8357): Pango-CRITICAL **: 09:26:45.562: > pango_font_description_set_size: assertion 'size >= 0' failed > > *** BUG *** > In pixman_region32_init_rect: Invalid rectangle passed > Set a breakpoint on '_pixman_log_error' to debug The pango message is definitely related somehow to the bug, the other warning is just a generic one we see even on Wayland/X11.
Created attachment 279681 [details] Screenshot showing same snippet in Broadway vs Wayland See difference for a label with following snippet. I see the Pango error in Broadway, not in Wayland public class Snippet34 { public static void main (String[] args) { Display display = new Display(); Shell shell = new Shell (display); shell.setText("Snippet 34"); Label label = new Label (shell, SWT.BORDER); Rectangle clientArea = shell.getClientArea (); label.setLocation (clientArea.x, clientArea.y); label.setText("Hello!"); label.pack (); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) { display.sleep (); } } display.dispose (); } }
I've reproduced the issue in a native GTK snippet (no SWT), and have filed a bug upstream with GTK: https://gitlab.gnome.org/GNOME/gtk/issues/2119
Furthermore: to work around this issue you can comment out the "GTK.gtk_widget_override_font" call in Widget.setFontDescription(). Setting a custom font won't work if you do this, but all text should render in the default font.
(In reply to Eric Williams from comment #10) > Furthermore: to work around this issue you can comment out the > "GTK.gtk_widget_override_font" call in Widget.setFontDescription(). Setting > a custom font won't work if you do this, but all text should render in the > default font. Good to know, thanks. I may implement this workaround for a demo one day if neither GTK nor SWT are fixed in the meantime.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172892
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172892 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=ba820ca1600b11d31a9a50d719d0c0d5a039ecd7
This bug appears to have been a bug filed against GTK3 but was in fact a GTK bug. It then appears to have been changed to GTK4 since gtk_widget_override_font() is deprecated in the new version. A gerrit patch was created and merged to fix this, so that Snippet 55 works correctly in GTK4. Marking this as resolved as the bug that was filed in GTK was resolved (https://gitlab.gnome.org/GNOME/gtk/issues/2119) and any new GTK4 bugs should have their own bug created.
Furthermore, in https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/136117/ it was decided that this deprecated function would be kept in GTK3 for stability reasons.