User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

GTK3 font chooser not working right...(SOLVED)

Sat Nov 26, 2016 10:45 am

Has anyone any experience of using the GTK3 font chooser dialog widget ? Seems to work OK on my MINT-17 box but if doesn't work on PI. The example text window does not get updated when a font is selected. Also my application fails to change the font in a textview window , probably for the same reason.

PeterO
Last edited by PeterO on Tue Nov 29, 2016 1:34 pm, edited 1 time in total.
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

gkreidl
Posts: 6042
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: GTK3 font chooser not working right...

Sat Nov 26, 2016 11:39 am

PeterO wrote:Has anyone any experience of using the GTK3 font chooser dialog widget ? Seems to work OK on my MINT-17 box but if doesn't work on PI. The example text window does not get updated when a font is selected. Also my application fails to change the font in a textview window , probably for the same reason.

PeterO
A lot of strange things started to happen with the installation of the fontconfig-infinality package (e. g. in claws mail). Unfortunately you cannot remove it without removing raspberrypi-ui-mods.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

Re: GTK3 font chooser not working right...

Sat Nov 26, 2016 12:27 pm

I've not heard of that package before. Seems it might be the cause though... Pretty poor if it goes around breaking such fundamental things as font selection though. Didn't anyone test it ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
DougieLawson
Posts: 35789
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: GTK3 font chooser not working right...

Sat Nov 26, 2016 12:50 pm

PeterO wrote:Didn't anyone test it ?
I think this post from the PIXEL designer answers that.
viewtopic.php?p=1070816#p1070816

His view appears to be "I don't care, as long as PIXEL works."
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

Re: GTK3 font chooser not working right...

Sat Nov 26, 2016 2:54 pm

After having to get in to my house's loft to fix a dripping ball-cock.....

I've just installed the GTK2 examples , and they work fine, so it looks like it probably a GTK3 problem rather than a PIXEL related issue.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

bust
Posts: 76
Joined: Mon Mar 17, 2014 12:31 am

Re: GTK3 font chooser not working right...

Sun Nov 27, 2016 2:07 am

Hi
I dont know if is on your folder /home/.config/gtk-3.0 or /root/.config/gtk-3.0

add a file named settings.ini

[Settings]
gtk-theme-name = Adwaita
gtk-icon-theme-name = oxygen
gtk-font-name = DejaVu Sans 12
gtk-cursor-theme-size = 18
gtk-toolbar-style = GTK_TOOLBAR_BOTH_HORIZ
gtk-xft-antialias = 1
gtk-xft-hinting = 1
gtk-xft-hintstyle = hintslight
gtk-xft-rgba = rgb
gtk-cursor-theme-name = Adwaita
EOF

execute command (gtk-query-immodules-3.0 --update-cache)

source gtk+-3.22.4 not work correctly with abiword-3.0.2 require 3.20.x
it's only problem abiword i think Gnumeric firefox-48.02,,Andacious,gedit etc... work well
gtk+-3.22.4

it's difficult to find problem, GTK-3 require several dependency (shared libraries)
(Do no take account version if you have more old version in your case)

Cairo Fontconfig, FreeType-2.7, HarfBuzz-1.3.3, at-spi2-atk-2.22.0, gdk-pixbuf-2.36.0, libepoxy-1.3.1,
Pango-1.40.3, hicolor-icon-theme-0.15, adwaita-icon-theme-3.22.0
Colord-1.2.12, Cups-2.2.1, DocBook-utils-0.6.14, GTK-Doc-1.25, JSON-GLib-1.2.2, libxkbcommon-0.7.0,
Wayland-1.12.0, wayland-protocols-1.7, rest etc ...

ldd ./usr/lib/libgtk-3.so.0.2200.4

libgdk-3.so.0 => /usr/lib/vfp/libgdk-3.so.0 (0xb689d000)
libXinerama.so.1 => /usr/lib/vfp/libXinerama.so.1 (0xb688b000)
libXrandr.so.2 => /usr/lib/vfp/libXrandr.so.2 (0xb6874000)
libXcursor.so.1 => /usr/lib/vfp/libXcursor.so.1 (0xb685d000)
libxcb-randr.so.0 => /usr/lib/vfp/libxcb-randr.so.0 (0xb6843000)
libxcb-shape.so.0 => /usr/lib/vfp/libxcb-shape.so.0 (0xb6830000)
libpangocairo-1.0.so.0 => /usr/lib/vfp/libpangocairo-1.0.so.0 (0xb6815000)
libXi.so.6 => /usr/lib/vfp/libXi.so.6 (0xb67f9000)
libXcomposite.so.1 => /usr/lib/vfp/libXcomposite.so.1 (0xb67e7000)
libcairo-gobject.so.2 => /usr/local/plx11_5/libcairo-gobject.so.2 (0xb67d0000)
libcairo.so.2 => /usr/local/plx11_5/libcairo.so.2 (0xb66eb000)
libpixman-1.so.0 => /usr/local/plx11_5/libpixman-1.so.0 (0xb6686000)
libEGL.so.1 => /usr/lib/vfp/libEGL.so.1 (0xb6651000)
libxcb-xfixes.so.0 => /usr/lib/vfp/libxcb-xfixes.so.0 (0xb663c000)
libgbm.so.1 => /usr/lib/vfp/libgbm.so.1 (0xb6622000)
libwayland-server.so.0 => /usr/lib/vfp/libwayland-server.so.0 (0xb6606000)
libdirectfb-1.7.so.7 => /usr/lib/vfp/libdirectfb-1.7.so.7 (0xb6509000)
libfusion-1.7.so.7 => /usr/lib/vfp/libfusion-1.7.so.7 (0xb64ed000)
libdirect-1.7.so.7 => /usr/lib/vfp/libdirect-1.7.so.7 (0xb64bc000)
libxcb-shm.so.0 => /usr/lib/vfp/libxcb-shm.so.0 (0xb64aa000)
libxcb-render.so.0 => /usr/lib/vfp/libxcb-render.so.0 (0xb6491000)
libXrender.so.1 => /usr/lib/vfp/libXrender.so.1 (0xb6479000)
libGL.so.1 => /usr/lib/vfp/libGL.so.1 (0xb6419000)
libxcb-dri3.so.0 => /usr/local/plx11_5/libxcb-dri3.so.0 (0xb6407000)
libxcb-present.so.0 => /usr/lib/vfp/libxcb-present.so.0 (0xb63f5000)
libxcb-sync.so.1 => /usr/lib/vfp/libxcb-sync.so.1 (0xb63e0000)
libxshmfence.so.1 => /usr/lib/vfp/libxshmfence.so.1 (0xb63cf000)
libglapi.so.0 => /usr/lib/vfp/libglapi.so.0 (0xb6385000)
libXdamage.so.1 => /usr/lib/vfp/libXdamage.so.1 (0xb6373000)
libXfixes.so.3 => /usr/lib/vfp/libXfixes.so.3 (0xb635f000)
libX11-xcb.so.1 => /usr/local/plx11_5/libX11-xcb.so.1 (0xb634d000)
libxcb-glx.so.0 => /usr/lib/vfp/libxcb-glx.so.0 (0xb632d000)
libxcb-dri2.so.0 => /usr/local/plx11_5/libxcb-dri2.so.0 (0xb631a000)
libXxf86vm.so.1 => /usr/lib/vfp/libXxf86vm.so.1 (0xb6306000)
libXext.so.6 => /usr/lib/vfp/libXext.so.6 (0xb62ec000)
libdrm.so.2 => /usr/lib/vfp/libdrm.so.2 (0xb62d1000)
libOpenVG.so.1 => /usr/lib/vfp/libOpenVG.so.1 (0xb62b9000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/vfp/libgdk_pixbuf-2.0.so.0 (0xb6298000)
libatk-bridge-2.0.so.0 => /usr/lib/vfp/libatk-bridge-2.0.so.0 (0xb6265000)
libatk-1.0.so.0 => /usr/lib/vfp/libatk-1.0.so.0 (0xb6239000)
libatspi.so.0 => /usr/lib/vfp/libatspi.so.0 (0xb6205000)
libSM.so.6 => /usr/lib/vfp/libSM.so.6 (0xb61ef000)
libICE.so.6 => /usr/lib/vfp/libICE.so.6 (0xb61ce000)
libX11.so.6 => /usr/local/plx11_5/libX11.so.6 (0xb60bd000)
libxcb.so.1 => /usr/lib/vfp/libxcb.so.1 (0xb6093000)
libXau.so.6 => /usr/lib/vfp/libXau.so.6 (0xb6081000)
libXdmcp.so.6 => /usr/lib/vfp/libXdmcp.so.6 (0xb606d000)
libbsd.so.0 => /usr/local/plx11_5/libbsd.so.0 (0xb6044000)
libdbus-1.so.3 => /usr/lib/vfp/libdbus-1.so.3 (0xb5ff8000)
libxkbcommon.so.0 => /usr/lib/vfp/libxkbcommon.so.0 (0xb5fb4000)
libwayland-cursor.so.0 => /usr/lib/vfp/libwayland-cursor.so.0 (0xb5f9e000)
libwayland-egl.so.1 => /usr/lib/vfp/libwayland-egl.so.1 (0xb5f8d000)
libwayland-client.so.0 => /usr/lib/vfp/libwayland-client.so.0 (0xb5f73000)
libepoxy.so.0 => /usr/lib/vfp/libepoxy.so.0 (0xb5eac000)
libpangoft2-1.0.so.0 => /usr/lib/vfp/libpangoft2-1.0.so.0 (0xb5e9b000)
libpango-1.0.so.0 => /usr/lib/vfp/libpango-1.0.so.0 (0xb5e4f000)
libgthread-2.0.so.0 => /usr/local/plx11_5/libgthread-2.0.so.0 (0xb5e3e000)
libfontconfig.so.1 => /usr/lib/vfp/libfontconfig.so.1 (0xb5dfe000)
libexpat.so.1 => /usr/lib/vfp/libexpat.so.1 (0xb5dd7000)
libcdio.so.16 => /usr/lib/vfp/libcdio.so.16 (0xb5dab000)
libilbc.so.2 => /usr/lib/vfp/libilbc.so.2 (0xb5d88000)
libpng12.so.0 => /usr/local/plx11_5/libpng12.so.0 (0xb5d5d000)
libharfbuzz.so.0 => /usr/lib/vfp/libharfbuzz.so.0 (0xb5d01000)
libfreetype.so.6 => /usr/lib/vfp/libfreetype.so.6 (0xb5c7a000)
libpng16.so.16 => /usr/local/plx11_5/libpng16.so.16 (0xb5c46000)
libgraphite2.so.3 => /usr/lib/vfp/libgraphite2.so.3 (0xb5c22000)
libgio-2.0.so.0 => /usr/local/plx11_5/libgio-2.0.so.0 (0xb5add000)
libgmodule-2.0.so.0 => /usr/local/plx11_5/libgmodule-2.0.so.0 (0xb5aca000)
libz.so.1 => /usr/local/rasglibc_5/libz.so.1 (0xb5aaa000)
libselinux.so.1 => /usr/local/rasglibc_5/libselinux.so.1 (0xb5a83000)
libresolv.so.2 => /usr/local/rasglibc_5/libresolv.so.2 (0xb5a6f000)
libmount.so.1 => /usr/local/rasglibc_5/libmount.so.1 (0xb5a29000)
libblkid.so.1 => /lib/libblkid.so.1 (0xb5983000)
libuuid.so.1 => /lib/libuuid.so.1 (0xb596f000)
libgobject-2.0.so.0 => /usr/local/plx11_5/libgobject-2.0.so.0 (0xb591a000)
libffi.so.6 => /usr/lib/vfp/libffi.so.6 (0xb5904000)
libglib-2.0.so.0 => /usr/local/plx11_5/libglib-2.0.so.0 (0xb580e000)
libiconv.so.2 => /usr/lib/vfp/libiconv.so.2 (0xb5725000)
libpcre.so.1 => /lib/libpcre.so.1 (0xb56e1000)
libc.so.6 => /usr/local/rasglibc_5/libc.so.6 (0xb55a8000)
libdl.so.2 => /usr/local/rasglibc_5/libdl.so.2 (0xb559d000)
libpthread.so.0 => /usr/local/rasglibc_5/libpthread.so.0 (0xb557d000)
libstdc++.so.6 => /usr/local/plx11_5/libstdc++.so.6 (0xb54ab000)
librt.so.1 => /usr/local/rasglibc_5/librt.so.1 (0xb549c000)
libm.so.6 => /usr/local/rasglibc_5/libm.so.6 (0xb53f2000)
/lib/ld-linux.so.3 (0x7f593000)
libgcc_s.so.1 => /usr/local/rasglibc_6/libgcc_s.so.1 (0xb53cc000)

I hope he can help you (even with my bad English.)
Regards

User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

Re: GTK3 font chooser not working right...

Sun Nov 27, 2016 9:15 am

bust wrote:Hi
I dont know if is on your folder /home/.config/gtk-3.0 or /root/.config/gtk-3.0

add a file named settings.ini

[Settings]
gtk-theme-name = Adwaita
gtk-icon-theme-name = oxygen
gtk-font-name = DejaVu Sans 12
gtk-cursor-theme-size = 18
gtk-toolbar-style = GTK_TOOLBAR_BOTH_HORIZ
gtk-xft-antialias = 1
gtk-xft-hinting = 1
gtk-xft-hintstyle = hintslight
gtk-xft-rgba = rgb
gtk-cursor-theme-name = Adwaita
EOF
This made no difference.

execute command (gtk-query-immodules-3.0 --update-cache)
gtk-query=immodules-3.0 is not installed on my PI

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

bust
Posts: 76
Joined: Mon Mar 17, 2014 12:31 am

Re: GTK3 font chooser not working right...

Sun Nov 27, 2016 1:56 pm

Hi
I forget (more easy)
load your sample
open new bash
ps -aux
find his number pid
execute lsof -p (number your pid sample)
He will give to you only your shared libraries used by your sample
(Maybe you can also use (core of gdb) for debug your sample)

(GTK3 work fine but require some time before he work perfectly with all packages)
NB
you can also flush your cache fonts with command (fc-cache -f -v)

Regards

bust
Posts: 76
Joined: Mon Mar 17, 2014 12:31 am

Re: GTK3 font chooser not working right...

Sun Nov 27, 2016 2:23 pm

Hi
gtk-query=immodules-3.0 is not installed on my PI
Strange ...
Paquet : libgtk-3-0 (3.14.5-1+deb8u1) (jessie)

Liste des fichiers du paquet libgtk-3-0 dans jessie pour l'architecture armhf

/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-am-et.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-broadway.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-cedilla.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-cyrillic-translit.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-inuktitut.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-ipa.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-multipress.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-thai.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-ti-er.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-ti-et.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-viqr.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/immodules/im-xim.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/printbackends/libprintbackend-cloudprint.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/printbackends/libprintbackend-lpr.so
/usr/lib/arm-linux-gnueabihf/gtk-3.0/3.0.0/printbackends/libprintbackend-test.so
/usr/lib/arm-linux-gnueabihf/libgdk-3.so.0
/usr/lib/arm-linux-gnueabihf/libgdk-3.so.0.1400.5
/usr/lib/arm-linux-gnueabihf/libgtk-3-0/gtk-query-immodules-3.0
/usr/lib/arm-linux-gnueabihf/libgtk-3-0/gtk-update-icon-cache-3.0
/usr/lib/arm-linux-gnueabihf/libgtk-3.so.0
/usr/lib/arm-linux-gnueabihf/libgtk-3.so.0.1400.5
/usr/share/doc/libgtk-3-0/AUTHORS
/usr/share/doc/libgtk-3-0/NEWS.gz
/usr/share/doc/libgtk-3-0/README.Debian
/usr/share/doc/libgtk-3-0/README.gz
/usr/share/doc/libgtk-3-0/changelog.Debian.gz
/usr/share/doc/libgtk-3-0/copyright

Regards

User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

Re: GTK3 font chooser not working right...

Sun Nov 27, 2016 2:47 pm

Simon spl23 has pointed me at GTK3's use of CSS for widget styling which we think is causing the odd behaviour. I'm investigating further.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 4940
Joined: Sun Jul 22, 2012 4:14 pm

Re: GTK3 font chooser not working right...

Tue Nov 29, 2016 1:34 pm

We've narrowed this down now. And as predicted it is due to the way GTK3 uses CSS to control styles in widgets. The GTK2 way of handling fonts is marked as "deprecated" and although it worked on earlier releases of GTK3 it now seems to be broken.

Here is a simple example of how to set a font in a widget....

Code: Select all

int main(int argc, char **argv)
{
    GtkBuilder *builder;
    GtkTextIter iter;
  
    gchar *css = "GtkTextView { font-family: monospace; }";
   
    gtk_init(&argc,&argv);

    GtkCssProvider *cssProvider = gtk_css_provider_new ();
    gtk_css_provider_load_from_data(cssProvider,css,-1,NULL);
    

    builder = gtk_builder_new ();
    if( gtk_builder_add_from_file (builder,"FontProblem.glade" , NULL) == 0)
    {
        printf("gtk_builder_add_from_file FAILED\n");
        return 1;
    }

    printerTextview = GTK_WIDGET (gtk_builder_get_object (builder, "textview1"));
    printerTextbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(printerTextview));
    
    gtk_text_buffer_get_end_iter (printerTextbuffer, &iter);
    gtk_text_buffer_create_mark (printerTextbuffer, "end", &iter, FALSE);



    gtk_style_context_add_provider(gtk_widget_get_style_context(printerTextview),
                                   GTK_STYLE_PROVIDER(cssProvider),
                                   GTK_STYLE_PROVIDER_PRIORITY_USER);

    gtk_builder_connect_signals (builder, NULL);


    gtk_main();

    return 0;
}

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

bust
Posts: 76
Joined: Mon Mar 17, 2014 12:31 am

Re: GTK3 font chooser not working right...(SOLVED)

Wed Nov 30, 2016 3:30 pm

Hi
Happy that you have solved your problem,I have add at my folder .config/gtk-3.0 file (gtk.css) with several parameter tested with the hope to solve the problem Abiword and gtk-3.22.4 but the problem is persisting. When you open him you have always blink black and white screen background . I have rebuild with new (rpath) for he call the libraries of 3.20.6 him only,he work now but not in Weston of Wayland.
An last version exist (gtk+-3.89.1) maybe able to solve this problem Abiword ?.
Regards

Return to “Graphics programming”