my $fontname = 'Arial'; find_ttf( $fontname); my $fontdir = '/home/myself/fonts'; my $fontdir2 = '/home/myself/.fonts'; push @LEOCHARRE::FontFind::PATH, $fontdir, $fontdir2; LEOCHARRE::FontFind::_cache_reset(); my $abs_font = find_ttf( $fontname, $fontdir, $fontdir2 );
Why?
Because I was rendering text with imagemagick, and what was taking 3 seconds each time was looking up for fonts. This makes it immediate.
Leo Charre leocharre at cpan dot org
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".
This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.
To install LEOCHARRE::FontFind, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LEOCHARRE::FontFind
CPAN shell
perl -MCPAN -e shell install LEOCHARRE::FontFind
For more information on module installation, please visit the detailed CPAN module installation guide.