Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 218772 - dev-php/PEAR-Image_Canvas-0.3.1: lacks fonts in /usr/share/php/Image/Canvas/Fonts
Summary: dev-php/PEAR-Image_Canvas-0.3.1: lacks fonts in /usr/share/php/Image/Canvas/F...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-21 19:55 UTC by Maxime Augier
Modified: 2010-10-22 19:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Example fix to create font symlinks at the appropriate location (PEAR-Image_Canvas-0.3.1.ebuild.patch,619 bytes, patch)
2008-04-21 19:57 UTC, Maxime Augier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Augier 2008-04-21 19:55:30 UTC
PEAR-Image_Canvas-0.3.1 expects its fonts to be placed in /usr/share/php/Image/Canvas/Fonts. The ebuild does not take any measures to install fonts at this location, although the needed font files can already be installed in /usr/share/fonts/corefonts by installing media-fonts/corefonts.

Not having these fonts by default breaks at least one application (net-analyzer/centreon, unable to generate pie charts).

Reproducible: Always

Steps to Reproduce:



Expected Results:  
The ebuild for PEAR-Image_Canvas should have the fonts installed automatically if available, or at least tell the user that fonts installation is needed.



Attached is my quick and dirty fix to have the ebuild automatically symlink fonts from media-font/corefonts. I'm quite certain this is not the proper way to do it, so please let a portage guru create a proper fix.
Comment 1 Maxime Augier 2008-04-21 19:57:26 UTC
Created attachment 150521 [details, diff]
Example fix to create font symlinks at the appropriate location
Comment 2 Matti Bickel (RETIRED) gentoo-dev 2010-03-28 20:06:30 UTC
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.
Comment 3 Matti Bickel (RETIRED) gentoo-dev 2010-03-28 21:50:18 UTC
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)
Comment 4 Matti Bickel (RETIRED) gentoo-dev 2010-03-28 21:52:24 UTC
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.