sciapp / gr

GR framework: a graphics library for visualisation applications
Other
329 stars 54 forks source link

Issues with fonts with precompiled package #69

Closed akiross closed 5 years ago

akiross commented 5 years ago

Hello, I would like to use the C interface to gr framework. I want to work on a confined development environment, so I downloaded a package for redhat from the downloads (I'm using Fedora 28) and unpacked it.

I can compile and link a simple application against it, but I am unable to obtain the correct output due to missing fonts:

GKS: file open error (/tmp/gr/fonts/gksfont.dat)
open: No such file or directory
GKS: could not open font file: /tmp/gr/fonts/NimbusSanL-Regu.pfb

I tried fixing this by linking the font directory to /tmp/gr/fonts, which partially fixes the issue as no error messages are printed now, but the output is definitely wrong, as you can see from the picture below

gr_framework_font_issue

How can I fix it? I tried searching for an API call to change font dir or load custom fonts, but I couldn't find it.

Thanks and best regards

jheinen commented 5 years ago

Could you try to set GRDIR to /tmp/gr (where you unpacked it) and use another output driver (than X11):

export GRDIR=/tmp/gr
export GKS_WSTYPE=gksqt
cfelder commented 5 years ago

You can also use either GRDIR as Josef Heinen already pointed out or GKS_FONTPATH see C code below:

int gks_open_font(void)
{
  const char *path;
  char fontdb[MAXPATHLEN];
  int fd;

  path = gks_getenv("GKS_FONTPATH");
  if (path == NULL)
    {
      path = gks_getenv("GRDIR");
      if (path == NULL)
        path = GRDIR;
    }
  strcpy(fontdb, (char *) path);
#ifndef _WIN32
  strcat(fontdb, "/fonts/gksfont.dat");
#else
  strcat(fontdb, "\\FONTS\\GKSFONT.DAT");
#endif
  fd = gks_open_file(fontdb, "r");

  return fd;
}

Furthermore we are providing linux packages using the open build service.

akiross commented 5 years ago

Sorry for the late answer.

@jheinen I tried with those envvar, but I get no output at all: the program runs with no visible window or message.

@cfelder thanks, I tried using GKS_FONTPATH but I continue to see black boxes in place of text. Thanks also for the other info.

I don't know if this could be relevant, but I am on Wayland.

danielkaiser commented 5 years ago

An issue with black text background in the X11 output should be solved with this commit: a9a7337b8c872f889251c5dd4e67d2c887bca0f7

Could you please check if this fix also solves your problem?

danielkaiser commented 5 years ago

I'm closing this issue because it should be fixed since the v0.40.0 release. If you still encounter this problem feel free to reopen this issue.