Unfortunately in GTK4, the font panel I’m using here is gone.
What do you suggest to do.
I don’t want to copy/paste your code in my software because it’s possible I’ll end up fixing more issues than needed. On top of that I’m not sure how it will be in terms of Copyright.
So, what should I do? How do I make it work?
As you can see I have 3 font selection pages there in a notebook and they look the same…
Thank you.
P.S.: I already asked to bring it back in GTK4 and got a reply that it will not be possible. But that post didn’t have a screenshot.
You still can use Gtk.FontChooserWidget, but it’s deprecated so will be removed in gtk5.
These font widgets are tailored for Linux/fontconfig and may not work well on other systems. This is why the new font selection interfaces in gtk4 now rely on things like xdg-portals to improve the system integration.
For your usecase I would suggest to use a simple Gtk.FontDialogButton for choosing the font face an size, and just keep the other settings like colors and underline in your interface.
The widget is being “removed” because on *nix systems—which are basically Linux, these days—we use sandboxing, and all the dialogs that interact with a system feature have been moved from widgets to asynchronous objects that handle the dialogs through calls to corresponding portals. This also allows using native dialogs on macOS and Windows.
While the font selection dialog does not have a corresponding portal—as of yet, at least—it would be bad to have a different API model than the rest of the dialogs provided by GTK. So, for consistency’s sake, GtkFontChooser and friends have been deprecated.
In the future, we will have different dialogs depending on the platform, as any platform has its own ideas of what a font selection dialog should look like.