gsl-shell icon indicating copy to clipboard operation
gsl-shell copied to clipboard

"Cannot find a suitable truetype font" error

Open shanipribadi opened this issue 8 years ago • 1 comments

Hello,

Running gsl-shell failed with "cannot find a suitable truetype font". (note: this is a very confusing error message) Looking around, I found that gsl-shell look for fonts in several hard coded paths listed in agg-plot/support_x11.cpp.

const char *ttf_names[] = {
    "ubuntu-font-family/Ubuntu-R.ttf",
    "freefont/FreeSans.ttf", "freefont-ttf/FreeSans.ttf", "FreeSans.ttf",
    "ttf-dejavu/DejaVuSans.ttf", "dejavu/DejaVuSans.ttf", "DejaVuSans.ttf",
    "liberation/LiberationSans-Regular.ttf", 0};
const char *ttf_system_dir[] = {"/usr/share/fonts/truetype", "/usr/share/fonts", "/usr/share/fonts/TTF", 0};

I would suggest using fontconfig font discovery methods instead of hardcoding the paths directly. In my case was that I have the fonts, but they are in a different path than what was hardcoded. Other approach is by allowing runtime configuration for the font path.

This is not really severe, but causes confusion, since the INSTALL did not mention the need to have the fonts on that exact paths.

Regards,

shanipribadi avatar Jul 08 '15 11:07 shanipribadi

Hi Shani,

thank you for pointing out this problem. The method I'm using to find the fonts is working on most distributions but probably the "right way" to discover the fonts if to use fontconfig, as you suggest.

Unfortunately I have a problem with this library because, as far as I can understand, a real documentation is missing. Looking at the official site http://www.freedesktop.org/wiki/Software/fontconfig/ I didn't find any explications about which functions you should use and how they should be called.

Actually I've already tried to use fontconfig and the Xft library when I began implementing the graphical system but I was blocked by the apparent lack of documentations of these two libraries.

In any case, I guess that by persisting enough I will be able to succeed and use the library but these means that I need more time to work on that.

In the mean time, if you are knowledgeable about the fontconfig library or if you feel that you can help me, please don't hesitate, I will appreciate a lot. Also don't forget that this is free software and anyone can contribute to improve it.

franko avatar Jul 10 '15 13:07 franko