Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 146713 - media-gfx/imagemagick ebuild needs to depend on corefonts
Summary: media-gfx/imagemagick ebuild needs to depend on corefonts
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Karol Wojtaszek (RETIRED)
URL:
Whiteboard:
Keywords:
: 147577 148089 153179 155436 186367 299840 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-09-07 09:34 UTC by Robert Kaufman
Modified: 2010-01-20 08:31 UTC (History)
14 users (show)

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


Attachments
ebuild compiles without: truetype, corefonts, fontconfig... (imagemagick-6.3.0.5-r1.ebuild,2.59 KB, text/plain)
2006-11-26 15:06 UTC, cilly
Details
patch to imagemagick-6.3.0.5.ebuild adding useflag corefonts (imagemagick-6.3.0.5.ebuild.patch,1.38 KB, patch)
2006-11-26 15:53 UTC, cilly
Details | Diff
only require corefonts with no X USE FLAG (nocorefonts.patch,319 bytes, patch)
2006-11-27 01:29 UTC, ta2002
Details | Diff
Make windows font support conditional based on USE=truetype (patch,1.29 KB, patch)
2007-01-30 20:08 UTC, Daniel Drake (RETIRED)
Details | Diff
imagemagick-6.3.0.5.ebuild (imagemagick-6.3.0.5.ebuild,2.74 KB, text/plain)
2007-02-08 15:12 UTC, Daniel Drake (RETIRED)
Details
imagemagick-6.3.0.5.ebuild (imagemagick-6.3.0.5.ebuild,2.83 KB, text/plain)
2007-02-08 15:36 UTC, Daniel Drake (RETIRED)
Details
files/imagemagick-6.3.0.5-configure-windows-fonts.patch (imagemagick-6.3.0.5-configure-windows-fonts.patch,726 bytes, patch)
2007-02-08 15:37 UTC, Daniel Drake (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Kaufman 2006-09-07 09:34:10 UTC
Hello,
  I have two servers (one x86 and one PPC) that have imagemagick emerged like so:

media-gfx/imagemagick-6.2.8.0
  USE="gs jpeg mpeg perl png tiff truetype xml zlib -X -bzip2 -doc -fpx -graphviz -jbig -jpeg2k -lcms -nocxx -wmf"

Neither of them have the corefont package, as they do not have X (note -X USE).  The corefont package is needed for text manipulation functions.

Thanks,
Rob Kaufman
Comment 1 Luca Barbato gentoo-dev 2006-09-07 10:57:08 UTC
I _think_ you need fonts, not specific fonts.
please reopen with some more information and a testcase.
Comment 2 Robert Kaufman 2006-09-09 16:05:47 UTC
When running the simple test:
convert label:abcde test.gif

The result is:
convert: unable to read font `/usr/share/fonts/corefonts/arial.ttf'.
convert: missing an image filename `test.gif'.

It would seem that this should work under the default install.  At the least it would seem right to have a corefonts use flag.
Comment 3 SpanKY gentoo-dev 2006-09-14 00:24:41 UTC
fixed in imagemagick-6.2.9.5
Comment 4 cilly 2006-09-14 13:41:37 UTC
imagemagick can be run without corefonts or font-support, especially when
useflag truetype is disabled, so the dependency to corefonts is unnecessary,
remove it!

emerge -tpvuDN world

These are the packages that would be merged, in reverse order:

Calculating world dependencies... done!
[ebuild     U ] media-gfx/imagemagick-6.2.9.5 [6.2.8.0] USE="bzip2 jpeg perl
png tiff xml zlib -X -doc -fpx -graphviz -gs -jbig -jpeg2k -lcms -mpeg -nocxx
-truetype -wmf" 5,252 kB 
[ebuild  N    ]  media-fonts/corefonts-1-r2  USE="-X" 3,842 kB 
[ebuild  N    ]   media-libs/fontconfig-2.3.2-r1  USE="-doc" 941 kB 
[ebuild  N    ]    media-libs/freetype-2.1.10-r2  USE="zlib -bindist -doc"
Comment 5 Robert Kaufman 2006-09-14 16:38:34 UTC
What happens when you run "convert label:abcde test.gif" on an imagemagick install that was emerged with out truetype enabled?

If imagemagick simply does not support labels w/o true type or if it successfully creates the image (does not display an error like in the bug report), then it would seem that the best choice is to have imagemagick depend on corefonts if and only if truetype is enabled. If there is still an error generated, it would see that there really is a dependancy.
Comment 6 Luca Barbato gentoo-dev 2006-09-14 17:33:40 UTC
I'd make upstream just look for Sans using fontconfig...
Comment 7 ta2002 2006-09-14 21:46:11 UTC
It looks like this has already slipped into stable, but to stick my opinion in.

From the page:

http://imagemagick.org/script/advanced-unix-installation.php

--without-x
don't use the X Window System.
By default, ImageMagick uses the X11 delegate libraries if they are available. When --without-x is specified, use of X11 is disabled. The display, animate, and import sub-commands are not included. The remaining sub-commands have reduced functionality such as no access to X11 fonts (consider using Postscript or TrueType fonts instead)

I think that the ebuild should prefer Postscript fonts (media-fonts/gnu-gs-fonts) to Microsoft fonts in this situation.
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2006-09-15 02:08:54 UTC
*** Bug 147577 has been marked as a duplicate of this bug. ***
Comment 9 SpanKY gentoo-dev 2006-09-18 10:22:30 UTC
*** Bug 148089 has been marked as a duplicate of this bug. ***
Comment 10 Luca Barbato gentoo-dev 2006-09-18 10:36:31 UTC
I'd remove the dep and tell people to symlink the font they like or patch it to use fontconfig and use Sans.
Comment 11 Jakub Moc (RETIRED) gentoo-dev 2006-10-28 16:26:55 UTC
*** Bug 153179 has been marked as a duplicate of this bug. ***
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2006-11-16 17:46:16 UTC
*** Bug 155436 has been marked as a duplicate of this bug. ***
Comment 13 cilly 2006-11-18 05:08:03 UTC
Imagemagick does not need the dependency on corefonts, it is possible to configure imagemagick --without-fontconfig --without-freetype. I did a test compile from the source.

Please add a useflag for the --without-fontconfig option.

Comment 14 SpanKY gentoo-dev 2006-11-26 05:56:53 UTC
post a patch showing what you mean
Comment 15 ta2002 2006-11-26 13:48:18 UTC
From the original bug report (and the documentation),
clearly ImageMagick does NOT require corefonts with
the X USE FLAG enabled. At a minimum the ebuild should
test for that case.
Comment 16 cilly 2006-11-26 15:06:15 UTC
Created attachment 102804 [details]
ebuild compiles without: truetype, corefonts, fontconfig...

Here is an ebuild which compiles fine without corefonts, without truetype. In this case, the configure script of imagemagick will do it's job and look for corefonts. If you compile imagemagick without fonts, then some commands won't be available.

The ebuild is just to show, that you do not need fonts for imagemagick.

I am working on an ebuild with a useflag corefonts which will add dependency to corefonts if the useflag is set.

The two lines:

                --with-gs-font-dir=/usr/share/fonts/default/ghostscript \
                --with-windows-font-dir=/usr/share/fonts/corefonts \

in the econf part will only be needed if truetype or corefont is set.

I think it is better to make corefonts like truetype as an option since it is not required for imagemagick.
Comment 17 SpanKY gentoo-dev 2006-11-26 15:09:13 UTC
i wasnt kidding when i said post a *patch*

regardless, i dont really see how those changes are any better than what we have currently
Comment 18 cilly 2006-11-26 15:10:36 UTC
@SpanKY

If I would have known to do it better I would have done it already, so I am sorry.
Comment 19 cilly 2006-11-26 15:12:14 UTC
@SpanKY

You force every installation of imagemagick to use corefonts and fontconfig, but since upstream leaves this as an option, gentoo should leave it as an option to the user to use fonts or not.
Comment 20 SpanKY gentoo-dev 2006-11-26 15:34:10 UTC
Comment on attachment 102804 [details]
ebuild compiles without: truetype, corefonts, fontconfig...

given the option of having all the features work correctly for everyone or have some features not work at all, i'm obviously going to choose the former

either post a properly flexible patch or the current situation will remain unchanged
Comment 21 cilly 2006-11-26 15:53:34 UTC
Created attachment 102810 [details, diff]
patch to imagemagick-6.3.0.5.ebuild adding useflag corefonts

This is my first patch I wrote. It adds a useflag "corefonts" which makes it optional to install.

I am not sure about the two directories within the ifstatement if both are needed for truetype or both are needed for corefonts.
Comment 22 ta2002 2006-11-27 01:29:24 UTC
Created attachment 102828 [details, diff]
only require corefonts with no X USE FLAG

Probably not the right way to do this, but I think it
would get rid of about ninety percent of the squawking.
Comment 23 cilly 2006-11-27 05:31:22 UTC
(In reply to comment #22)
> Created an attachment (id=102828) [edit]
> only require corefonts with no X USE FLAG
> 
> Probably not the right way to do this, but I think it
> would get rid of about ninety percent of the squawking.
> 

Why do you wanna force imagemagick to be built with corefonts, if you are running a headless system -X?

I need imagemagick for the server only with no fonts and no gui, imagemagick is used with coppermine and so there is no font support needed at all.

Usually, the configure script is looking for dependencies and useflags make it easier to set a dependency by the user. Forcing the user to use a dependency which is not necessary is not the right way and it would break gentoo's way of use: "leave it to the user".
Comment 24 ta2002 2006-11-27 07:48:16 UTC
(In reply to comment #23)
> (In reply to comment #22)

> Why do you wanna force imagemagick to be built with corefonts,
> if you are running a headless system -X?

I agree with you, but right now the ebuild forces EVERYONE to
use corefonts - something that affects FAR more people.

I don't like the idea of adding use flags for individual packages
like fonts. I would suggest a "nofonts" use flag instead (which
will still accomplish what you want, but require a proactive
configuration decision on your part).
Comment 25 cilly 2006-11-27 08:01:31 UTC
(In reply to comment #24)
> 
> I don't like the idea of adding use flags for individual packages
> like fonts. I would suggest a "nofonts" use flag instead (which
> will still accomplish what you want, but require a proactive
> configuration decision on your part).
> 

Good point, every solution which lets the option to the user whether to use imagemagick with fonts or not is good.


Comment 26 Duncan 2006-11-27 10:24:03 UTC
(In reply to comment #24)
> I don't like the idea of adding use flags for individual packages
> like fonts. I would suggest a "nofonts" use flag instead (which
> will still accomplish what you want, but require a proactive
> configuration decision on your part).

The devs don't like no-anything type USE flags, and try to only use them if there'd normally be DIRE results for turning the flag on (nocxx for example, will kill python and thus portage, I am told).

Thus, "nofonts" isn't likely, but something like "fonts" might be.

Comment 27 Daniel Drake (RETIRED) gentoo-dev 2007-01-30 20:02:34 UTC
Reopening as this is significant and I'm happy to help fixing it.

The base of the issue seems to be that the ebuild unconditionally uses --with-windows-font-dir=/usr/share/fonts/corefonts and at least in terms of that, adding the unconditional dep on corefonts was correct.

However, imagemagick can operate fine without these "windows fonts", this dependency introduces some other unwanted stuff, and the licensing for corefonts sucks -- this really needs to be made optional.

Unsetting X/truetype/other USE flags does not help here -- the convert command given earlier ("convert label:abcde test.gif") is still able to operate correctly even without X and truetype support provided that it can find a font.

If no windows font dir is specified (i.e. "--with-windows-font-dir=") then the above command works fine regardless of corefonts' presence, this is because it then uses ghostscript to render the text.

Here are 3 possible solutions:

1. Always specify no windows font dir and let it use ghostscript.
This isn't a great idea as it probably causes some other functionality to suffer and also removes the option of using windows fonts.

2. Extend the meaning of USE=truetype to cover windows font stuff. I think this is an acceptable extension because after all these windows fonts are actually just truetype fonts. In this case the corefonts dep would be conditional based on USE=truetype, and windows font path would either be "" or "/usr/share/fonts/corefonts" again depending on the USE flag.

3. Add a fallback in the imagemagick code to fall back onto ghostscript if font rendering with windows fonts fails. This isn't as easy as it sounds due to upstream code mess.  Their code really only wants to work with one font engine and in the TTF case it really wants to work with a single flat directory. In the long term hopefully this will improve (e.g. to use fontconfig).


I prefer #2 from the list above, patch coming up shortly.
Comment 28 Daniel Drake (RETIRED) gentoo-dev 2007-01-30 20:08:29 UTC
Created attachment 108683 [details, diff]
Make windows font support conditional based on USE=truetype
Comment 29 Robert Kaufman 2007-01-30 20:39:59 UTC
In regards to comment 27, I much prefer option 2) as you then get the desired basic functionality out of the box, but can go back and add more fonts in (or change the fonts) if you find the render is not the font you want.  The most important reason to me for opening this in the first place was that a basic function used in the imagemagick FAQ to assure your installation was working correctly, was failing out of the box on Gentoo.  Instantiating Daniel Drake's patch I believe solves that original issue in a more satisfactory way that simple always requiring corefonts (at least now that I understand why some one would want to not have it).
Comment 30 Daniel Drake (RETIRED) gentoo-dev 2007-02-02 23:05:30 UTC
Mike asks:
<@vapier> if you have imagemagick on a server without X or corefonts, how 
                can the label: command work

Using --without-ttf (and all other flags except the ones mentioned) turned off:

If configured with "--with-windows-font-dir=/usr/share/fonts/corefonts" it fails:
convert: unable to read font `/usr/share/fonts/corefonts/arial.ttf'.
convert: missing an image filename `test.gif'.

If configured with "--with-windows-font-dir= --with-gs-font-dir=/usr/share/fonts/default/ghostscript --without-gslib" then it works. strace shows it open()ing files such as /usr/share/fonts/default/ghostscript/n019003l.afm
This also works after unmerging ghostscript-gpl but fails when gnu-gs-fonts-std is also unmerged.

So, I guess the answer to the question is: it uses ghostscript fonts (but doesn't require the gs libs to do so)
Comment 31 Daniel Drake (RETIRED) gentoo-dev 2007-02-04 22:39:20 UTC
Should use this instead:
$(use_with truetype windows-font-dir /usr/share/fonts/corefonts)

will test and commit tomorrow
Comment 32 Daniel Drake (RETIRED) gentoo-dev 2007-02-05 14:56:32 UTC
Doesn't work. USE=-truetype causes --without-windows-font-dir rather than --with-windows-font-dir=

Mike, should upstream Makefile be fixed or should we handle this at the ebuild level something like my earlier patch?
Comment 33 Regis 2007-02-07 20:49:48 UTC
Would a "virtual/truetype" package solve this problem?
Comment 34 Daniel Drake (RETIRED) gentoo-dev 2007-02-07 21:09:30 UTC
no
Comment 35 Regis 2007-02-08 02:03:51 UTC
(In reply to comment #34)
> no
> 

Here's a better question:  How can including the word "corefonts" in the imagemagick ebuild be reasonable?  Imagemagick has absolutely nothing to do with Microsoft's fonts.  Requiring such a dependency is absurd.  I'm not trolling.  Please create a suitable workaround, or suggest to others an alternative method you consider acceptable, and we'll do it.
Comment 36 Daniel Drake (RETIRED) gentoo-dev 2007-02-08 03:09:12 UTC
This has already been explained above, but here it is again:

ImageMagick is SPECIFICALLY written to include support for WINDOWS FONTS. It is after all both a Windows and Linux app.
corefonts is the only provider of windows fonts in Portage. Ripping out support for Windows fonts in imagemagick would be removing functionality which is not something we commonly do at the ebuild level.

The correct solution is to make the dependency conditional since it can ALSO work with ghostscript fonts. If you look at the last few comments you will see that work is underway to make that so.
Comment 37 Duncan 2007-02-08 09:27:31 UTC
(In reply to comment #35)
> 
> Imagemagick has absolutely nothing to do with Microsoft's fonts.
> [Please suggest] an alternative method you consider acceptable,
> and we'll do it.

FWIW, Gentoo actually provides (at least) TWO workarounds.  You can take your pick based on your needs. =8^)  I'm not too happy about the dependency either, for the reasons explained below, but since they are working on it and there are workarounds in the meantime, it's not /so/ bad.

Simply stick media-fonts/corefonts-99 or some such in your package.provided file.   That's what I did here, since I can't agree to the corefonts EULA, and since those may be legal/enforceable here in the US, it's therefore of questionable legality for me to merge the corefonts package.  For more information on package.provided, see the portage (5) manpage.

As mentioned "up bug", that does break some of the text functionality.  However, I'm not likely to use that anyway as imagemagick is just an image processing dependency of a couple things I have merged and I'm not likely to be doing fancy things with text in them and thus in imagemagick.  

For those that need the text functionality, there's the overlay method.  Stick the ebuild in your overlay and edit it to point at the ghostscript fonts or whatever, instead of depending on corefonts.  Then redigest and merge as usual.

See, it's not /so/ bad, since there are already workarounds available.  One just needs to learn to use the tools Gentoo already provides.  =8^)
Comment 38 Daniel Drake (RETIRED) gentoo-dev 2007-02-08 15:12:51 UTC
Created attachment 109537 [details]
imagemagick-6.3.0.5.ebuild

updated ebuild
Comment 39 Daniel Drake (RETIRED) gentoo-dev 2007-02-08 15:36:27 UTC
Created attachment 109550 [details]
imagemagick-6.3.0.5.ebuild

updated ebuild
Comment 40 Daniel Drake (RETIRED) gentoo-dev 2007-02-08 15:37:12 UTC
Created attachment 109552 [details, diff]
files/imagemagick-6.3.0.5-configure-windows-fonts.patch

configure fix
Comment 41 Daniel Drake (RETIRED) gentoo-dev 2007-02-08 16:02:01 UTC
in portage
Comment 42 Jakub Moc (RETIRED) gentoo-dev 2007-07-23 19:38:12 UTC
*** Bug 186367 has been marked as a duplicate of this bug. ***
Comment 43 Markus Meier gentoo-dev 2010-01-19 23:03:56 UTC
*** Bug 299840 has been marked as a duplicate of this bug. ***