All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
@ 2015-06-16  2:12 grepper
  2015-06-16  3:39 ` Baruch Siach
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: grepper @ 2015-06-16  2:12 UTC (permalink / raw)
  To: buildroot

From: Robert Sohn <grepper@gmail.com>

It appears that Imagemagick needs to be configured with
 --with-gs-font-dir=/usr/share/fonts/gs else it will not find
the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
will contain the wrong font paths. You end up with messages like:
Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
They are non-fatal but could get annoying fast if you are using 'convert'
on a lot of files.

Signed-off-by: Robert Sohn <grepper@gmail.com>
---
 package/imagemagick/imagemagick.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
index 298d0a8..1abb2a8 100644
--- a/package/imagemagick/imagemagick.mk
+++ b/package/imagemagick/imagemagick.mk
@@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
 	--without-dps \
 	--without-gslib \
 	--without-fpx \
-	--without-x
+	--without-x \
+	--with-gs-font-dir=/usr/share/fonts/gs
 
 IMAGEMAGICK_DEPENDENCIES = host-pkgconf
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2015-06-16  2:12 [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts grepper
@ 2015-06-16  3:39 ` Baruch Siach
  2015-06-16 18:27   ` grepper
  2015-12-29 16:45 ` Thomas Petazzoni
  2016-07-04 15:50 ` Peter Korsgaard
  2 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2015-06-16  3:39 UTC (permalink / raw)
  To: buildroot

Hi Robert,

On Mon, Jun 15, 2015 at 10:12:26PM -0400, grepper wrote:
> From: Robert Sohn <grepper@gmail.com>
> 
> It appears that Imagemagick needs to be configured with
>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
> will contain the wrong font paths. You end up with messages like:
> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
> They are non-fatal but could get annoying fast if you are using 'convert'
> on a lot of files.
> 
> Signed-off-by: Robert Sohn <grepper@gmail.com>
> ---
>  package/imagemagick/imagemagick.mk | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
> index 298d0a8..1abb2a8 100644
> --- a/package/imagemagick/imagemagick.mk
> +++ b/package/imagemagick/imagemagick.mk
> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
>  	--without-dps \
>  	--without-gslib \
>  	--without-fpx \
> -	--without-x
> +	--without-x \
> +	--with-gs-font-dir=/usr/share/fonts/gs

These fonts are only available when the ghostscript-fonts is built, isn't it? 
If so, then this should be

ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
endif

Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
duplicating it?

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2015-06-16  3:39 ` Baruch Siach
@ 2015-06-16 18:27   ` grepper
  2015-06-16 20:01     ` Baruch Siach
  0 siblings, 1 reply; 9+ messages in thread
From: grepper @ 2015-06-16 18:27 UTC (permalink / raw)
  To: buildroot

On 15/06/15 11:39 PM, Baruch Siach wrote:
> Hi Robert,
> 
> On Mon, Jun 15, 2015 at 10:12:26PM -0400, grepper wrote:
>> From: Robert Sohn <grepper@gmail.com>
>>
>> It appears that Imagemagick needs to be configured with
>>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
>> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
>> will contain the wrong font paths. You end up with messages like:
>> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
>> They are non-fatal but could get annoying fast if you are using 'convert'
>> on a lot of files.
>>
>> Signed-off-by: Robert Sohn <grepper@gmail.com>
>> ---
>>  package/imagemagick/imagemagick.mk | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
>> index 298d0a8..1abb2a8 100644
>> --- a/package/imagemagick/imagemagick.mk
>> +++ b/package/imagemagick/imagemagick.mk
>> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
>>  	--without-dps \
>>  	--without-gslib \
>>  	--without-fpx \
>> -	--without-x
>> +	--without-x \
>> +	--with-gs-font-dir=/usr/share/fonts/gs
> 
> These fonts are only available when the ghostscript-fonts is built, isn't it? 
> If so, then this should be
> 
> ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
> IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
> endif
> 
> Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
> duplicating it?
> 
> baruch
> 

Hm, the problem is that the issue will remain if ghostscript-fonts are
not installed. I don't know the solution to that. It seems strange that
imagemagick can not find a default font when 'convert -list font' shows
many, ttf and otherwise.

Robert

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2015-06-16 18:27   ` grepper
@ 2015-06-16 20:01     ` Baruch Siach
  0 siblings, 0 replies; 9+ messages in thread
From: Baruch Siach @ 2015-06-16 20:01 UTC (permalink / raw)
  To: buildroot

Hi Robert,

On Tue, Jun 16, 2015 at 02:27:23PM -0400, grepper wrote:
> On 15/06/15 11:39 PM, Baruch Siach wrote:
> > On Mon, Jun 15, 2015 at 10:12:26PM -0400, grepper wrote:
> >> From: Robert Sohn <grepper@gmail.com>
> >>
> >> It appears that Imagemagick needs to be configured with
> >>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
> >> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
> >> will contain the wrong font paths. You end up with messages like:
> >> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
> >> They are non-fatal but could get annoying fast if you are using 'convert'
> >> on a lot of files.
> >>
> >> Signed-off-by: Robert Sohn <grepper@gmail.com>
> >> ---
> >>  package/imagemagick/imagemagick.mk | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
> >> index 298d0a8..1abb2a8 100644
> >> --- a/package/imagemagick/imagemagick.mk
> >> +++ b/package/imagemagick/imagemagick.mk
> >> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
> >>  	--without-dps \
> >>  	--without-gslib \
> >>  	--without-fpx \
> >> -	--without-x
> >> +	--without-x \
> >> +	--with-gs-font-dir=/usr/share/fonts/gs
> > 
> > These fonts are only available when the ghostscript-fonts is built, isn't it? 
> > If so, then this should be
> > 
> > ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
> > IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
> > endif
> > 
> > Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
> > duplicating it?
> 
> Hm, the problem is that the issue will remain if ghostscript-fonts are
> not installed. I don't know the solution to that.

The usual way to set a dependency package is to add a 'select' statement for 
that package in Config.in. In this case ghostscript-fonts is not a hard 
dependency, because imagemagick is quite functional without it, and its size 
is non negligible. Maybe adding a comment to the help text in Config.in would 
suffice.

What do others think?

> It seems strange that imagemagick can not find a default font when 'convert 
> -list font' shows many, ttf and otherwise.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2015-06-16  2:12 [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts grepper
  2015-06-16  3:39 ` Baruch Siach
@ 2015-12-29 16:45 ` Thomas Petazzoni
  2016-07-04 15:50 ` Peter Korsgaard
  2 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2015-12-29 16:45 UTC (permalink / raw)
  To: buildroot

Hello Robert,

Sorry for the long delay in replying to your patch.

On Mon, 15 Jun 2015 22:12:26 -0400, grepper wrote:

> It appears that Imagemagick needs to be configured with
>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
> will contain the wrong font paths. You end up with messages like:
> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
> They are non-fatal but could get annoying fast if you are using 'convert'
> on a lot of files.

Could you give a specific example use of imagemagick that triggers this
problem, so that we can reproduce the problem on our side and
investigate the possible solutions?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2015-06-16  2:12 [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts grepper
  2015-06-16  3:39 ` Baruch Siach
  2015-12-29 16:45 ` Thomas Petazzoni
@ 2016-07-04 15:50 ` Peter Korsgaard
  2 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2016-07-04 15:50 UTC (permalink / raw)
  To: buildroot

On Tue, Jun 16, 2015 at 4:12 AM, grepper <grepper@gmail.com> wrote:

Sorry for the slow response!

> It appears that Imagemagick needs to be configured with
>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
> will contain the wrong font paths. You end up with messages like:
> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
> They are non-fatal but could get annoying fast if you are using 'convert'
> on a lot of files.
>
> Signed-off-by: Robert Sohn <grepper@gmail.com>

Committed after extending the commit message, thanks!

--
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2016-02-09 17:23 ` Yann E. MORIN
@ 2016-02-09 18:16   ` Ricardo Martincoski
  0 siblings, 0 replies; 9+ messages in thread
From: Ricardo Martincoski @ 2016-02-09 18:16 UTC (permalink / raw)
  To: buildroot

Yann E. MORIN, All,

I tried to reply to 2 mails at once. Sorry I created some confusion.

On Tue, Feb 09, 2016 at 03:23 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> On 2016-02-09 02:29 -0200, Ricardo Martincoski spake thusly:
[SNIP]
>> On Tue, 29 Dec 2015 17:45:04 +0100, Thomas Petazzoni wrote:
>> > Could you give a specific example use of imagemagick that triggers this
>> > problem, so that we can reproduce the problem on our side and
>> > investigate the possible solutions?
>> 
>> Using this config with the master branch:
>> BR2_PACKAGE_IMAGEMAGICK=y  
>> BR2_PACKAGE_GHOSTSCRIPT_FONTS=y
>> BR2_PACKAGE_FREETYPE=y
>> The problem can be triggered by converting any text file to ps
>> $ cd /tmp ; echo -e 'text 1\ntext 2' > file.txt ; convert file.txt file.ps
> 
> Aha, so that is the root of the problem. Thanks for the explanations.

---------------------------------------------------------------
--- end of the reply to Thomas and begin of reply to Baruch ---
---------------------------------------------------------------

> 
> [--SNIP--]

[UN-SNIP]
On Tue, Feb 09, 2016 at 03:23 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> On 2016-02-09 02:29 -0200, Ricardo Martincoski spake thusly:
>> On Tue Jun 16 20:01:02 UTC 2015, Baruch Siach wrote:
>> > On Tue, Jun 16, 2015 at 02:27:23PM -0400, grepper wrote:
>> >> On 15/06/15 11:39 PM, Baruch Siach wrote:
>> >> > On Mon, Jun 15, 2015 at 10:12:26PM -0400, grepper wrote:
[/UN-SNIP]

>> The wrong path is the default for debian-based distros
>> /usr/share/fonts/type1/gsfonts/ # debian non-x11, default for imagemagick
>> /usr/share/fonts/X11/Type1/     # debian x11
>> 
>> An alternative solution would be to have the fonts installed to this location
>> +++ b/package/ghostscript-fonts/ghostscript-fonts.mk
>> @@@ -13,1 -13,1 +13,1 @@@ GHOSTSCRIPT_FONTS_LICENSE_FILES = COPYI
>> --GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/gs
>> ++GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/type1/gsfonts
>> 
>> I don't see from
>> grep -w '\(gs\|ghostscript-fonts\|GHOSTSCRIPT_FONTS_\)' -R package/
>> any explicit use of this path nor hard dependency.
>> But changing it can potentially break packages (in runtime!) if them expect
>> the fonts to be installed in the current location.
> 
> And why not symlink the former to the latter?

Symlink seems an acceptable solution to me. 

> 
>> Does anyone know an example of package that would break?
>> 
>> >> >> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
>> >> >> They are non-fatal but could get annoying fast if you are using 'convert'
>> 
>> The error is non-fatal in a batch conversion.
>> But each error means a file failed to be converted.
>> The output is not generated for the failed file.
> 
> This is a sad decision not to fail in that case... :-(
> 
>> >> >> on a lot of files.
>> >> >>
>> >> >> Signed-off-by: Robert Sohn <grepper@gmail.com>
>> >> >> ---
>> >> >>  package/imagemagick/imagemagick.mk | 3 ++-
>> >> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >> >>
>> >> >> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
>> >> >> index 298d0a8..1abb2a8 100644
>> >> >> --- a/package/imagemagick/imagemagick.mk
>> >> >> +++ b/package/imagemagick/imagemagick.mk
>> >> >> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
>> >> >>  	--without-dps \
>> >> >>  	--without-gslib \
>> >> >>  	--without-fpx \
>> >> >> -	--without-x
>> >> >> +	--without-x \
>> >> >> +	--with-gs-font-dir=/usr/share/fonts/gs
>> 
>> Configuring unconditionally does not seem so bad in this case, IMO.
>> The configured path will be added to an XML that will be used at runtime.
>> If freetype support is not compiled in or the fonts are not installed,
>> /convert/ would fail anyway.
> 
> The best would probbly to do something like Thomas suggested:

Actually it was Baruch who suggested, see my UN-SNIP above

> 
>> >> > ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
>> >> > IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
>> >> > endif
>> BR2_PACKAGE_FREETYPE is also needed.
> 
>     ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_PACKAGE_GHOSTSCRIPT_FONTS),yy)
>     IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
>     endif
> 
> But with the symlink I suggested above, that might not even be
> necessary, would it?

No. Not necessary.

> 
>> >> > Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
>> >> > duplicating it?
>> 
>> It seems good practice to me.
>> But we can't use GHOSTSCRIPT_FONTS_TARGET_DIR as is, it is prefixed with
>> TARGET_DIR. We could create an auxiliary symbol
> 
> Then what about:
> 
>     package/ghostscript-fonts/ghostscript-fonts.mk;
>         GHOSTSCRIPT_FONTS_DIR = /usr/share/fonts/gs
>         GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/$(GHOSTSCRIPT_FONTS_DIR)
> 
>     package/imagemagick/imagemagick.mk:
>         ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_PACKAGE_GHOSTSCRIPT_FONTS),yy)
>         IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=$(GHOSTSCRIPT_FONTS_DIR)
>         endif

I have no strong opinion among the discussed solutions (or any combination):
1) symlink for font dir
2) configure path
3) user-friendly entry on the menu

> 
>> >> Hm, the problem is that the issue will remain if ghostscript-fonts are
>> >> not installed. I don't know the solution to that.
>> >
>> >The usual way to set a dependency package is to add a 'select' statement for 
>> >that package in Config.in. In this case ghostscript-fonts is not a hard 
>> >dependency, because imagemagick is quite functional without it, and its size 
>> >is non negligible. Maybe adding a comment to the help text in Config.in would 
>> >suffice.
>> >
>> >What do others think?
>> 
>> Adding a comment to the Config.in sounds reasonable to me.
>> One would need both BR2_PACKAGE_FREETYPE as optional build dependency and
>> BR2_PACKAGE_GHOSTSCRIPT_FONTS as optional runtime dependency to get the
>> conversion txt -> ps to work.
> 
> Well, since it is an *optional* and *runtime* dependency, then there is
> rally nothing to do, neither in the Config.in nor in the .mk.
> 
> However, if we want to be a little bit user-friendly, we could add a
> Config.in opiton in ImageMagick, like:
> 
>     config BR2_PACKAGE_IMAGEMAGICK_TXT_PS
>         bool "support txt->ps conversion"
>         select BR2_PACKAGE_FREETYPE # runtime

freetype is build time

>         select BR2_PACKAGE_GHOSTSCRIPT_FONTS # runtime
> 
> (with the appropriate "depends on" to propagate freetype's and
> ghostscript-fonts' own dependencies...
> 
> Anyway, thanks a lot Ricardo for the thorough and detailed explanations.
> It was really useful. :-)

You are welcome.

Regards,
Ricardo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
  2016-02-09  4:29 Ricardo Martincoski
@ 2016-02-09 17:23 ` Yann E. MORIN
  2016-02-09 18:16   ` Ricardo Martincoski
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2016-02-09 17:23 UTC (permalink / raw)
  To: buildroot

Ricardo, All,

On 2016-02-09 02:29 -0200, Ricardo Martincoski spake thusly:
> I don't need this patch for my own personal use, but I took a look into it.

Thank you, this is very much appreciated! :-)

> On Tue, 29 Dec 2015 17:45:04 +0100, Thomas Petazzoni wrote:
> > Could you give a specific example use of imagemagick that triggers this
> > problem, so that we can reproduce the problem on our side and
> > investigate the possible solutions?
> 
> Using this config with the master branch:
> BR2_PACKAGE_IMAGEMAGICK=y  
> BR2_PACKAGE_GHOSTSCRIPT_FONTS=y
> BR2_PACKAGE_FREETYPE=y
> The problem can be triggered by converting any text file to ps
> $ cd /tmp ; echo -e 'text 1\ntext 2' > file.txt ; convert file.txt file.ps

Aha, so that is the root of the problem. Thanks for the explanations.

[--SNIP--]
> The wrong path is the default for debian-based distros
> /usr/share/fonts/type1/gsfonts/ # debian non-x11, default for imagemagick
> /usr/share/fonts/X11/Type1/     # debian x11
> 
> An alternative solution would be to have the fonts installed to this location
> +++ b/package/ghostscript-fonts/ghostscript-fonts.mk
> @@@ -13,1 -13,1 +13,1 @@@ GHOSTSCRIPT_FONTS_LICENSE_FILES = COPYI
> --GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/gs
> ++GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/type1/gsfonts
> 
> I don't see from
> grep -w '\(gs\|ghostscript-fonts\|GHOSTSCRIPT_FONTS_\)' -R package/
> any explicit use of this path nor hard dependency.
> But changing it can potentially break packages (in runtime!) if them expect
> the fonts to be installed in the current location.

And why not symlink the former to the latter?

> Does anyone know an example of package that would break?
> 
> >> >> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
> >> >> They are non-fatal but could get annoying fast if you are using 'convert'
> 
> The error is non-fatal in a batch conversion.
> But each error means a file failed to be converted.
> The output is not generated for the failed file.

This is a sad decision not to fail in that case... :-(

> >> >> on a lot of files.
> >> >>
> >> >> Signed-off-by: Robert Sohn <grepper@gmail.com>
> >> >> ---
> >> >>  package/imagemagick/imagemagick.mk | 3 ++-
> >> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >> >>
> >> >> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
> >> >> index 298d0a8..1abb2a8 100644
> >> >> --- a/package/imagemagick/imagemagick.mk
> >> >> +++ b/package/imagemagick/imagemagick.mk
> >> >> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
> >> >>  	--without-dps \
> >> >>  	--without-gslib \
> >> >>  	--without-fpx \
> >> >> -	--without-x
> >> >> +	--without-x \
> >> >> +	--with-gs-font-dir=/usr/share/fonts/gs
> 
> Configuring unconditionally does not seem so bad in this case, IMO.
> The configured path will be added to an XML that will be used at runtime.
> If freetype support is not compiled in or the fonts are not installed,
> /convert/ would fail anyway.

The best would probbly to do something like Thomas suggested:

> >> > ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
> >> > IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
> >> > endif
> BR2_PACKAGE_FREETYPE is also needed.

    ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_PACKAGE_GHOSTSCRIPT_FONTS),yy)
    IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
    endif

But with the symlink I suggested above, that might not even be
necessary, would it?

> >> > Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
> >> > duplicating it?
> 
> It seems good practice to me.
> But we can't use GHOSTSCRIPT_FONTS_TARGET_DIR as is, it is prefixed with
> TARGET_DIR. We could create an auxiliary symbol

Then what about:

    package/ghostscript-fonts/ghostscript-fonts.mk;
        GHOSTSCRIPT_FONTS_DIR = /usr/share/fonts/gs
        GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/$(GHOSTSCRIPT_FONTS_DIR)

    package/imagemagick/imagemagick.mk:
        ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_PACKAGE_GHOSTSCRIPT_FONTS),yy)
        IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=$(GHOSTSCRIPT_FONTS_DIR)
        endif

> >> Hm, the problem is that the issue will remain if ghostscript-fonts are
> >> not installed. I don't know the solution to that.
> >
> >The usual way to set a dependency package is to add a 'select' statement for 
> >that package in Config.in. In this case ghostscript-fonts is not a hard 
> >dependency, because imagemagick is quite functional without it, and its size 
> >is non negligible. Maybe adding a comment to the help text in Config.in would 
> >suffice.
> >
> >What do others think?
> 
> Adding a comment to the Config.in sounds reasonable to me.
> One would need both BR2_PACKAGE_FREETYPE as optional build dependency and
> BR2_PACKAGE_GHOSTSCRIPT_FONTS as optional runtime dependency to get the
> conversion txt -> ps to work.

Well, since it is an *optional* and *runtime* dependency, then there is
rally nothing to do, neither in the Config.in nor in the .mk.

However, if we want to be a little bit user-friendly, we could add a
Config.in opiton in ImageMagick, like:

    config BR2_PACKAGE_IMAGEMAGICK_TXT_PS
        bool "support txt->ps conversion"
        select BR2_PACKAGE_FREETYPE # runtime
        select BR2_PACKAGE_GHOSTSCRIPT_FONTS # runtime

(with the appropriate "depends on" to propagate freetype's and
ghostscript-fonts' own dependencies...

Anyway, thanks a lot Ricardo for the thorough and detailed explanations.
It was really useful. :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts.
@ 2016-02-09  4:29 Ricardo Martincoski
  2016-02-09 17:23 ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Ricardo Martincoski @ 2016-02-09  4:29 UTC (permalink / raw)
  To: buildroot

Hello all,

I don't need this patch for my own personal use, but I took a look into it.

On Tue, 29 Dec 2015 17:45:04 +0100, Thomas Petazzoni wrote:
> Could you give a specific example use of imagemagick that triggers this
> problem, so that we can reproduce the problem on our side and
> investigate the possible solutions?

Using this config with the master branch:
BR2_PACKAGE_IMAGEMAGICK=y  
BR2_PACKAGE_GHOSTSCRIPT_FONTS=y
BR2_PACKAGE_FREETYPE=y
The problem can be triggered by converting any text file to ps
$ cd /tmp ; echo -e 'text 1\ntext 2' > file.txt ; convert file.txt file.ps

And doing this on the target works around the problem
$ sed -e s,/usr/share/fonts/type1/gsfonts,/usr/share/fonts/gs,g -i /etc/ImageMagick-6/type-ghostscript.xml


On Tue Jun 16 20:01:02 UTC 2015, Baruch Siach wrote:
>On Tue, Jun 16, 2015 at 02:27:23PM -0400, grepper wrote:
>> On 15/06/15 11:39 PM, Baruch Siach wrote:
>> > On Mon, Jun 15, 2015 at 10:12:26PM -0400, grepper wrote:
>> >> From: Robert Sohn <grepper@gmail.com>
>> >>
>> >> It appears that Imagemagick needs to be configured with
>> >>  --with-gs-font-dir=/usr/share/fonts/gs else it will not find
>> >> the ghostscript fonts and /etc/ImageMagick-6/type-ghostscript.xml
>> >> will contain the wrong font paths. You end up with messages like:

The wrong path is the default for debian-based distros
/usr/share/fonts/type1/gsfonts/ # debian non-x11, default for imagemagick
/usr/share/fonts/X11/Type1/     # debian x11

An alternative solution would be to have the fonts installed to this location
+++ b/package/ghostscript-fonts/ghostscript-fonts.mk
@@@ -13,1 -13,1 +13,1 @@@ GHOSTSCRIPT_FONTS_LICENSE_FILES = COPYI
--GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/gs
++GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/type1/gsfonts

I don't see from
grep -w '\(gs\|ghostscript-fonts\|GHOSTSCRIPT_FONTS_\)' -R package/
any explicit use of this path nor hard dependency.
But changing it can potentially break packages (in runtime!) if them expect
the fonts to be installed in the current location.

Does anyone know an example of package that would break?

>> >> Magick: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1153
>> >> They are non-fatal but could get annoying fast if you are using 'convert'

The error is non-fatal in a batch conversion.
But each error means a file failed to be converted.
The output is not generated for the failed file.

>> >> on a lot of files.
>> >>
>> >> Signed-off-by: Robert Sohn <grepper@gmail.com>
>> >> ---
>> >>  package/imagemagick/imagemagick.mk | 3 ++-
>> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/package/imagemagick/imagemagick.mk b/package/imagemagick/imagemagick.mk
>> >> index 298d0a8..1abb2a8 100644
>> >> --- a/package/imagemagick/imagemagick.mk
>> >> +++ b/package/imagemagick/imagemagick.mk
>> >> @@ -33,7 +33,8 @@ IMAGEMAGICK_CONF_OPTS = \
>> >>  	--without-dps \
>> >>  	--without-gslib \
>> >>  	--without-fpx \
>> >> -	--without-x
>> >> +	--without-x \
>> >> +	--with-gs-font-dir=/usr/share/fonts/gs

Configuring unconditionally does not seem so bad in this case, IMO.
The configured path will be added to an XML that will be used at runtime.
If freetype support is not compiled in or the fonts are not installed,
/convert/ would fail anyway.

>> > 
>> > These fonts are only available when the ghostscript-fonts is built, isn't it? 

Yes.

>> > If so, then this should be
>> > 
>> > ifeq ($(BR2_PACKAGE_GHOSTSCRIPT_FONTS),y)
>> > IMAGEMAGICK_CONF_OPTS += --with-gs-font-dir=/usr/share/fonts/gs
>> > endif

BR2_PACKAGE_FREETYPE is also needed.

>> > 
>> > Or maybe we should use $(GHOSTSCRIPT_FONTS_TARGET_DIR) here, instead of 
>> > duplicating it?

It seems good practice to me.
But we can't use GHOSTSCRIPT_FONTS_TARGET_DIR as is, it is prefixed with
TARGET_DIR. We could create an auxiliary symbol

+++ b/package/ghostscript-fonts/ghostscript-fonts.mk
@@@ -13,1 -13,1 +13,2 @@@ GHOSTSCRIPT_FONTS_LICENSE_FILES = COPYI
--GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/usr/share/fonts/gs
++GHOSTSCRIPT_FONTS_DIR = /usr/share/fonts/gs
++GHOSTSCRIPT_FONTS_TARGET_DIR = $(TARGET_DIR)/$(GHOSTSCRIPT_FONTS_DIR)
+++ b/package/imagemagick/imagemagick.mk
@@@ -37,1 -37,1 +37,1 @@@ IMAGEMAGICK_CONF_OPTS = 
--	--with-gs-font-dir=/usr/share/fonts/gs
++	--with-gs-font-dir=$(GHOSTSCRIPT_FONTS_DIR)

>> 
>> Hm, the problem is that the issue will remain if ghostscript-fonts are
>> not installed. I don't know the solution to that.
>
>The usual way to set a dependency package is to add a 'select' statement for 
>that package in Config.in. In this case ghostscript-fonts is not a hard 
>dependency, because imagemagick is quite functional without it, and its size 
>is non negligible. Maybe adding a comment to the help text in Config.in would 
>suffice.
>
>What do others think?

Adding a comment to the Config.in sounds reasonable to me.
One would need both BR2_PACKAGE_FREETYPE as optional build dependency and
BR2_PACKAGE_GHOSTSCRIPT_FONTS as optional runtime dependency to get the
conversion txt -> ps to work.

Regards,
Ricardo

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-04 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16  2:12 [Buildroot] [PATCH 1/1] Allow imagemagick to find ghostscript fonts grepper
2015-06-16  3:39 ` Baruch Siach
2015-06-16 18:27   ` grepper
2015-06-16 20:01     ` Baruch Siach
2015-12-29 16:45 ` Thomas Petazzoni
2016-07-04 15:50 ` Peter Korsgaard
2016-02-09  4:29 Ricardo Martincoski
2016-02-09 17:23 ` Yann E. MORIN
2016-02-09 18:16   ` Ricardo Martincoski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.