开发者

fswebcam: Unable to load font 'luxisr': libgd was not built with FreeType font support

I'm developing on an embedded device using OpenWRT. Whenever I try to use fswebcam to capture and image from my /dev/video0 and want to add some text to the image (--info switch), I get this error.

So the standard font 'luxisr' doesn't work. I've tried supplying my own .ttf font. Same result. Is there a font that fswebcam will be able开发者_高级运维 to use without changing my current install, i.e. current libgd build? I'm thinking that including freetype font support in libgd, rebuilding and re-installing will be non-trivial (why wouldn't they enable it by default then).

Thanks for any help on this...

UPDATE [march 31st, 2011]: I've posed this question to Philip Heron, the author of fswebcam. This morning he let me know that:

fswebcam right now can only use TTF fonts, and relies on freetype support in libgd to be able to render them. There's two options:

  1. Rebuild libgd with freetype support. I'm not familiar with the OpenWRT build system but this might be the easiest option. Freetype seems to be packaged already so it shouldn't be too painful.

  2. libgd also has a simple bitmap font built-in. I could have fswebcam fall back on this if no freetype support is detected, but it won't look nearly as good.

-Phil

So I'm going ahead and willbe re/cross-compiling libgd with freetype support.


What you can do is:

  • Add libfreetype to .config
  • Change [buildroot_DIR]/package/feeds/packages/gd/Makefile

and set line --without-freetype to --with-freetype=$(STAGING_DIR)/usr

  • (re-)build libgd and libfreetype packages and update OpenWrt system
  • Then get a copy of the desired ttf (e.g. ubuntu /usr/share/fonts/truetype/freefont/FreeSans.ttf)

  • export GDFONTPATH

  • set desired font in fswebcam.config


I had the exact same problem. As far as I am concerned, fswebcam relies on the libgd library, which use the $GDFONTPATH environment variable to locate fonts. Within my environment (Ubuntu 11.04), such variable was not set.

Issuing an strace on the command line

$ strace fswebcam --font Arial:12 --save /tmp/test/test.jpg

Resulted in the following output

access("/usr/X11R6/lib/X11/fonts/TrueType/Arial.ttf", R_OK) = -1 ENOENT (No such file or directory)

...

access("/usr/X11R6/lib/X11/fonts/TTF/Arial.ttf", R_OK) = -1 ENOENT (No such file or directory)

...

Which got me thinking that there were some problems with font look-up.

Setting a GDFONTPATH worked around the issue. For instance, I have used the following

$ export GDFONTPATH=~/.fonts/

Use (or any other font)

$ locate Arial.ttf

To get your font dir, which vary depending on your OS (/usr/local/share/fonts/truetype, /usr/share/fonts/truetype, ...) . Your millage may vary.

I'm sure something cleaner could be used but this solution works out. Hope this help.


I found this question in google with the same error. Just for info in debian:

apt-get install ttf-xfree86-nonfree

and add to fswebcam.conf:

font /usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisr.ttf

and run

fswebcam --config /etc/fswebcam.conf

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜