Subject: Re: [X2Go-Dev] Bug#884: Bug#884: Bug#884: nxagent aborts session with 'Could not open default font 'fixed''

From: Ulrich Sibiller <[email-masked]>
Date: Wed, 3 Jun 2015 10:16:35 +0200

On Tue, Jun 2, 2015 at 11:41 PM, Michael DePaulo <[email-masked]> wrote:
> A quick look at some distros where nxagent works.
>
> Out of the 5 dirs listed:
>
> Ubuntu 14.04 contains:
> /usr/share/fonts/ (no "misc" under it)
> /usr/share/fonts/X11/misc/
>
> RHEL 7.1 contains:
> /usr/share/fonts/ (no "misc" under it)
> /usr/share/X11/fonts/misc/

You can us the -fp option of nxagent/x2goagent to pass an arbitrary
font path. Furthermore you could set up an heuristic that determines
valid font paths. For our company internal script we use this (ugly)
code:

           fontpath=""
           while read fp ; do
               [ -r ${fp%:unscaled}/fonts.dir ] || continue
               [[ ",$fontpath," == *,$fp,* ]] ||
fontpath=${fontpath:+$fontpath,}${fp}
           done < <(
               for xlog in /var/log/Xorg.0.log /var/log/XFree86.0.log ; do
                   sed -n -e "1,/FontPath set to:/d" -e "s/,$//" -e
"s/^        //p" $xlog 2> /dev/null # TAB!
                   grep "FontPath set to " $xlog 2> /dev/null | cut
-d\" -f2 | tr , "\012"
               done
               for xconf in /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*
/etc/X11/XF86Config ; do
                   grep FontPath $xconf 2> /dev/null | grep \" | cut -d\" -f2
               done
               grep /fonts/ /etc/X11/fs/config 2> /dev/null | sed -e
"s/^[catalogue =   ]*//" -e "s/,$//"
               (
                   ls /etc/X11/fontpath.d/*/fonts.dir
/usr/share/fonts/*/fonts.dir /usr/share/X11/fonts/*/fonts.dir
/usr/share/fonts/X11/*/fonts.dir /usr/X11R6/lib/X11/fonts/*/fonts.dir
/usr/lib/X11/fonts/*/fonts.dir
                   locate /fonts.dir | grep "^/usr"
               ) 2> /dev/null | sed -n "s|/fonts.dir$||p"
               strings ${NXPATH}/*/nxagent* 2> /dev/null | grep
/fonts/ | tr , "\012"
           ) 2> /dev/null

           [ -z "$fontpath" ] && read count fontpath < <( strings
/usr/bin/X* /usr/X11R6/bin/X* 2>&1 | grep "/fonts/.*," | sed
"s,^[^/]*,," | sort | uniq -c | sort -nr | head -1 )
         echo remote_fontpath=\"$fontpath\"

Uli