umlaeute / Gem

Graphics Environment for Multimedia (official repository)
https://gem.iem.at
Other
103 stars 30 forks source link

[text3d]: unable to open xxx.ttf #361

Closed jcp76300 closed 1 year ago

jcp76300 commented 1 year ago

On a Raspberry Pi under RaspberryOS, I can't use any font, even vera.ttf ! Anybody had the same issue ? How to solve it ?

umlaeute commented 1 year ago

try passing the full path to the font.

jcp76300 commented 1 year ago

[font /home/.local/.fonts/vera.ttf( | [text3d]

error : [text3d]: unable to open '/home/.local/.fonts/vera.ttf'

Even when I do [openpanel] [font $1]

[text3d]

same error, with any ttf or otf font at any path

jcp76300 commented 1 year ago

After research in the GEM source codes, it seems that it is in the TextBaseFTGL.cpp file at line 190 that the error occurs: m_font=makeFont(bufptr) would return NULL at line 191 and therefore the display of the error on line 192. Can you confirm ?

umlaeute commented 1 year ago

how did you obtain Gem? self-compiled or via your OS's package manager (apt-get install gem)?

You could also try building the demo applications that come with ftgl (apt-get install libftgl-dev), to see whether there's a fundamental problem with FTGL:

You can use the following makefile to build the examples in the /usr/share/doc/libftgl-dev/examples/ directory (after copying the files to some writeable place, and uncompressing them)

applications=c-demo simple
default: $(applications)

CFLAGS=$(shell pkg-config --cflags ftgl glut glu gl) -DHAVE_GL_GLUT_H=1
CXXFLAGS=$(CFLAGS)
LDLIBS=$(shell pkg-config --libs ftgl glut glu gl) -lm

config.h:
    touch $@

$(applications): config.h

.PHONY: clean
clean:
    rm -f $(applications)
    rm -f config.h
jcp76300 commented 1 year ago

I got Gem via deken in Pd. I've installed libftgl-dev yet, via apt-get.

jcp76300 commented 1 year ago

You could also try building the demo applications that come with ftgl (apt-get install libftgl-dev), to see whether there's a fundamental problem with FTGL:

You can use the following makefile to build the examples in the /usr/share/doc/libftgl-dev/examples/ directory (after copying the files to some writeable place, and uncompressing them)

applications=c-demo simple
default: $(applications)

CFLAGS=$(shell pkg-config --cflags ftgl glut glu gl) -DHAVE_GL_GLUT_H=1
CXXFLAGS=$(CFLAGS)
LDLIBS=$(shell pkg-config --libs ftgl glut glu gl) -lm

config.h:
  touch $@

$(applications): config.h

.PHONY: clean
clean:
  rm -f $(applications)
  rm -f config.h

I did it and obtained the following errors :

jcp@raspberrypi:~/ftgl-dev $ make touch config.h Package glut was not found in the pkg-config search path. Perhaps you should add the directory containing glut.pc' to the PKG_CONFIG_PATH environment variable No package 'glut' found Package glut was not found in the pkg-config search path. Perhaps you should add the directory containingglut.pc' to the PKG_CONFIG_PATH environment variable No package 'glut' found cc -DHAVE_GL_GLUT_H=1 c-demo.c config.h -lm -o c-demo cc1: fatal error: c-demo.c: Aucun fichier ou dossier de ce type compilation terminated. make: *** [ : c-demo] Erreur 1

umlaeute commented 1 year ago

well, apt-get install libglut-dev libftgl-dev to get all the dependencies...

jcp76300 commented 1 year ago

apt-get can't find libglut-dev

jcp76300 commented 1 year ago

I installed

sudo apt-get install freeglut3-dev libftgl-dev

and it answers they are already the most recent installed versions

umlaeute commented 1 year ago

doh, it seems that the old version of freeglut3-dev shipped with your system doesn't ship a pkg-config script... :-/

what's the output of the following command?

for p in ftgl glu gl; do pkg-config --libs $p; done

if all of them can be found, you probably can just change the Makefile to use:

CFLAGS=$(shell pkg-config --cflags ftgl glu gl) -DHAVE_GL_GLUT_H=1
CXXFLAGS=$(CFLAGS)
LDLIBS=-lglut $(shell pkg-config --libs ftgl glu gl) -lm

once you've managed to build the examles, try something like

./c-demo /home/.local/.fonts/vera.ttf

only now i've discovered that you say

I got Gem via deken in Pd.

in general this is not advisable (at least for Linux systems). better install it via

apt-get install gem'
jcp76300 commented 1 year ago
for p in ftgl glu gl; do pkg-config --libs $p; done

returns

-lftgl
-lGLU -lGL
-lGL
umlaeute commented 1 year ago

well, then my above modifications to the makefile should allow you to compile and test the examples.

neverthless, do try the apt-provided package of Gem.

jcp76300 commented 1 year ago

It compiled successfully ! Greetings.

but after (/.fonts dir is in /home/jcp, not in home/.local)

./c-demo /home/jcp/.fonts/vera.ttf

answer is

./c-demo: couldn't load font /home/jcp/.fonts/vera.ttf
jcp76300 commented 1 year ago
sudo apt-get install gem

already done

umlaeute commented 1 year ago

./c-demo: couldn't load font /home/jcp/.fonts/vera.ttf

Then I'm afraid the problem is a general FTGL problem, and needs to be fixed there.

You probably should file a bug against your distribution, something like

reportbug libftgl2

Since the problem is not actionable upon on our side, I'm closing this. Good luck