gnuplot links against gd to do font resolution. gd allows to use fontconfig for font resolution. fontconfig has a proper search path with caches to find all installed fonts, great. However, gd does not use fontconfig by default, each application needs to request this:
gnuplot seems not to request this, hence gd falls back to doing a search itself.
The searchpath of gd is defined by DEFAULT_PATH in the source. When already defined, it will take the set value (so we can override during the build). This default is set to /usr/share/fonts/truetype. After a quick question in #-dev it seems noone has this directory on all their machines checked. Conclusion, the default is not helping any Gentoo user. Unfortunately gd doesn't look recursively into subdirs, so setting the default to /usr/share/fonts won't help. Initially I thought setting it to /usr/share/fonts/corefonts would make sense, but when others started suggesting dejavu, etc. I realised there is basically no good default for this, since it depends on the user.
At runtime the search path for gd when not using fontconfig can be overridden using GDFONTPATH. I suggest, to make apps like gnuplot work by default as expected (and avoid elog messages about GDFONTPATH in the ebuild as such) by setting GDFONTPATH via env.d or something. It's value should be updated by the font.eclass (in the font_xft_config function perhaps?) such that after resourcing, apps using gd without requesting fontconfig will find installed fonts.
I have no patches other than changing the default path in gd via the ebuild, as I first want to validate the idea and see how much support there is to solve it like this.
> Unfortunately gd doesn't look recursively into subdirs, so setting
> the default to /usr/share/fonts won't help.
But you can look recursively when setting up GDFONTPATH in env.d:
for x in $(find /usr/share/fonts/ -type d); do
Unfortunately, this would have to live in /etc/profile, since /etc/env.d/ only allows static definitions (I think).
where exactly do you see it being set to /usr/share/fonts/truetype ? looks to me like the default is multiple paths and is perfectly sane. adding stuff like that to env.d is not desirable at all.
$ grep -C 2 DEFAULT_FONTPATH.*True /usr/include/gd.h
/* default fontpath for unix systems - whatever happened to standards ! */
#define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:/usr/lib/X11/fonts/Type1:/usr/openwin/lib/X11/fonts/Type1"
$ strings /usr/lib/libgd.so | grep TrueType