Search code examples
dockerfontsguacamole

Setting up apache guacamole with custom font for ssh


I am trying to set up a powerline modded font for SSH connection using apache guacamole docker container.

The container is set up and working and without setting a font name everything works well.

Once I enter a font name I get weird spacing and use of the wrong font, example

Here is how my container is set:

docker run --name=guacamole -d \
--network exposed-containers \
--restart=unless-stopped \
-e GUACD_HOSTNAME=guacd \
-e MYSQL_HOSTNAME=mariadb \
-e MYSQL_DATABASE=guacamole \
-e MYSQL_USER=guacamole \
-e MYSQL_PASSWORD=redacted \
-v /usr/share/fonts/Hack-Regular.ttf:/usr/share/fonts/Hack-Regular.ttf \
-v /usr/share/fonts/dejavu.ttf:/usr/share/fonts/dejavu.ttf \
-v /usr/share/fonts/notomono.ttf:/usr/share/fonts/notomono.ttf \
-p 9011:8080 guacamole/guacamole

Inside the container the fonts are detected and are working fine:

root@49d47e4258d3:/opt/guacamole# fc-list
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/dejavu.ttf: DejaVu Sans Mono for Powerline:style=Book
/usr/share/fonts/Hack-Regular.ttf: Hack:style=Regular
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/notomono.ttf: Noto Mono for Powerline:style=Regular
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
root@49d47e4258d3:/opt/guacamole#

The font I am trying to use is monospace as is needed for guacamole and I have used that font before on linux and windows so I know it works.

What am I missing?


Solution

  • Download a monospace font like Droid Sans Mono

    for Centos:

    yum install google-droid-sans-mono-fonts
    

    it will download a font named "DroidSansMono.ttf"

    now edit user-mapping.xml under /etc/guacamole

    My connection parameters are like this

     <connection name="localhost">
                <protocol>ssh</protocol>
                <param name="hostname">ServerName</param>
                <param name="port">22</param>
                <param name="password">PassWord</param>
                <param name="font-name">DroidSansMono</param>
                <param name="font-size">10</param>
       </connection>
    

    Note the font name and the "font-name" parameter are same except ttf extension. I can see the fonts properly now.enter image description here