Error allocating font with tcl/tk

This issue arises when trying to run a snap built for a python tkinter application:

_tkinter.TclError: failed to allocate font due to internal system font engine problem 

Is this a problem that is solved for gtk apps using the gtk3-desktop plug already? Or perhaps it is a bug? I don’t know much about fontconfig or how fonts are found on the system.

This has also been posted on the askubuntu forum but with seemingly no solution:

https://stackoverflow.com/questions/45499865/trouble-allocating-fonts-in-a-tcl-tk-based-ubuntu-snap-app

Here are the parts from my snapcraft.yaml file:

grade: stable 
confinement: devmode
icon: ../img/logo.png
  
apps:
  dataexplore:
    command: bin/dataexplore
    plugs: [home,x11,unity7]
parts:
  dataexplore:    
    plugin: python
    python-version: python3
    source: ../
    stage-packages: 
      [python3-tk,fontconfig-config,fonts-dejavu-extra]
    
  files: #to deal with problem finding init.tcl
    plugin: dump
    source: /usr/share/tcltk/
    organize:
        '*': ./usr/lib/
1 Like

here is a snap i did before the dektop launchers existed, take a look at the wrapper script and stage-packages …

(you might want to add a font as well to stage-packages like “fonts-dejavu-core” )

The answer is just to use the desktop launcher. Using desktop-glib-only is sufficient to allow the snap to run. Adding the fonts to stage-packages is also needed. Cheers.

1 Like