Summary: | dev-php/PEAR-Image_Canvas-0.3.1: lacks fonts in /usr/share/php/Image/Canvas/Fonts | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Maxime Augier <max> |
Component: | [OLD] Library | Assignee: | PHP Bugs <php-bugs> |
Status: | RESOLVED UPSTREAM | ||
Severity: | minor | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Example fix to create font symlinks at the appropriate location |
Description
Maxime Augier
2008-04-21 19:55:30 UTC
Created attachment 150521 [details, diff]
Example fix to create font symlinks at the appropriate location
If we already install the correct fonts somewhere else we need to tell PEAR-Image_Canvas where to find them. I'll have a look. Actually, no, it doesn't expect its fonts in /usr/share/php/Image/Canvas/Fonts I had a look at the source and the order in which the font is tried is: IMAGE_CANVAS_SYSTEM_FONT_PATH (defaults to empty) dirname(__FILE__) . '/Fonts/' (the one you noted) GD lookup if it's a relative path So we can safely fall back to GD here, IF you have GDFONTPATH set. Which we don't have by default. You can try adding: putenv('GDFONTPATH=' . '/usr/share/fonts/corefonts'); If you only care about the windows fonts (needs media-fonts/corefonts) One Problem though: if you specify a windows font name like 'Courier New' and expect it to work - well, no, it won't. That seems to a bug. You can change Canvas/Tool.php Line 112 to say "$result = $filename;" so it won't set the filename to "Courier New" but "cour.ttf" instead. Without it, GD looks for "Courier/New.ttf", AFAIK (http://de2.php.net/manual/en/function.imagefttext.php) Bottom line: the library works as advertised. It's the responsibility of the app using it to ensure a working GD setup. But i'll take the mentioned glitch in Tool.php upstream. |