1

In a nutshell:

Which package(s) must I install on Ubuntu 16.04 server to have full font-support for perl-modules that can draw text into images?

In detail:

I have Ubuntu 16.04.1 LTS (server, i.e. without GUI) running on a virtual machine, and I have an old Ubuntu 14.04 server (also without GUI) from which I want to move some applications to the new 16.04 machine. The application described below is working on the old machine, but not on the new one.

I have a webserver (apache) running on this machine, and there I have a website that contains an e-mail-form with a captcha (an image displaying some text). I generate this captcha with a perl script using the cpan module Imager.

In this perl script is this command that loads a font so that I later can use it to draw letters into an image:

my $font = Imager::Font->new(file=>$font_filename) or die "Cannot load $font_filename: ", Imager->errstr;

where $font_filename is the filename of an existing ttf-font. (I checked this. The font is there and it is readable.) But this command fails. I get this error message:

Cannot load /path/to/fontdir/opensans-bold.ttf: No font drivers enabled that can support this file, rebuild Imager with any of ft2 (FreeType 2.x), tt (FreeType 1.x) to use this font file at ./myPerlScript.pl line 123.

The message says that I should "rebuild Imager with any of ft2 (FreeType 2.x), tt (FreeType 1.x)".

I don't know how to do this.

I think that I need to install a package that contains fonts-support for ubuntu 16.04 and then re-install the cpan module Imager.

If there is really just a package missing: Which one is it?
If the problem is something else: What must I do to enable Imager to work with my ttf-font?

0

I found the answer myself:

The missing packet was libfreetype6-dev:

apt install libfreetype6-dev

But I also had to install this to get Imager work properly (not because of fonts, but because of reading and writing images):

apt install libpng-dev  
apt install libjpeg-dev  
cpanm install Imager::File::PNG  
cpanm install Imager::File::JPEG  
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.