#1019717 Display of an SVG file broken due to gsfonts transition

Package:
graphicsmagick
Source:
graphicsmagick
Description:
collection of image processing tools
Submitter:
Russ Allbery
Date:
2024-03-07 08:51:02 UTC
Severity:
normal
#1019717#5
Date:
2022-09-14 00:21:07 UTC
From:
To:
Attempting to display an SVG file breaks due to a missing font file:

% gm display _static/spawning.svg
gm display: Unable to read font (/usr/share/fonts/type1/gsfonts/n019003l.pfb) [No such file or directory].

(The image in question was created via the Python seqdiag package, which
is packaged in Debian as python3-seqdiag, although I am using it directly
from PyPI via a virtualenv.)

This is presumably due to the transition from gsfonts to fonts-urw-base35
recently discussed on debian-devel:

https://lists.debian.org/debian-devel/2022/08/msg00263.html

I'm not sure precisely what has to change in GraphicsMagick to use the
new package, though.

#1019717#10
Date:
2022-09-14 14:45:20 UTC
From:
To:
The path to the fonts may be configured via the --with-gs-font-dir
configure option.

The configure script does check /usr/share/fonts/type1/gsfonts but
perhaps the path has been overridden, or the fonts-urw-base35 package
was not installed when the configure script was executed, or there is
a bug.

Bob

#1019717#15
Date:
2023-05-22 16:46:12 UTC
From:
To:
The issue is still present in libgraphicsmagick-q16-3 v. 1.4+really1.3.40-4 and makes using the library with the standard config files somehow unusable as soon as any SVG with a "text" container is involved.  It would be great if a fix would be available before the final Bookworm release.

Thanks, Albrecht.

#1019717#20
Date:
2023-05-23 19:43:11 UTC
From:
To:
Digging a little deeper into this, I /think/ this is a bug in the GraphicsMagick source file http://hg.code.sf.net/p/graphicsmagick/code/file/tip/config/type-ghostscript.mgk.in which hard-codes the font file names and just makes the path configurable.

I added the attached patch file to the Debian patches and re-build the package, which now processes SVG files as expected, so this seems to be a fix.

Also attached is the *very* ugly Python script I used to extract the URW font paths from the Ghostscript config and to modify type-ghostscript.mgk.in - maybe it is helpful.

Thanks, Albrecht.

#1019717#25
Date:
2023-05-23 20:38:50 UTC
From:
To:
Hi Albrecht, Bob,

[Written a day ago, forgot to send.]
 It's an upstream bug; there was a gsfonts -> fonts-urw-base35
transition which resulted in different font files. But GM has the font
names hardcoded. The default seems to be n019003l.pfb [1] and font
variants are also hardcoded [2]. But the package fonts-urw-base35 has
none of these pfb files.
Not sure what to do at this point. Alter the font names in GM or ship
the hardcoded fonts?

Regards,
Laszlo/GCS
[1] http://hg.graphicsmagick.org/hg/GraphicsMagick/file/c41d8933edef/magick/nt_base.c#l1713
[2] http://hg.graphicsmagick.org/hg/GraphicsMagick/file/c41d8933edef/wmf/src/font.h#l82
[3] https://packages.debian.org/bookworm/all/fonts-urw-base35/filelist

#1019717#30
Date:
2023-05-23 20:46:21 UTC
From:
To:
 These fixes [1] you submitted look OK, let's loop-in the upstream developer.

Thanks,
Laszlo/GCS
[1] https://bugs.debian.org/1019717#20

#1019717#35
Date:
2023-05-24 01:15:44 UTC
From:
To:
Sorry, I had totally forgotten about this issue.

I did not see the final generated product attached to the issue.  On
the system I am looking at, there is a
/etc/ghostscript/fontmap.d/10gsfonts.conf file which must be similar
in nature to the /etc/ghostscript/fontmap.d/10fonts-urw-base35.conf
which Debian is using.

Rather than modify type-ghostscript.mgk.in, it is likely better to
create a new file "type-urw-base35.mgk" and add it to the list of
files specifically for Debian.  Since the font installation paths are
fixed for Debian then just store hard-coded paths in the mgk file
since there is no reason to configure or search for them.

I recall that Ghostscript (i.e. "Artifex Software, Inc.") has disowned
the original set of font files which was distributed with it so
perhaps these URW fonts are not accurately described as Ghostscript
fonts.

GraphicsMagick should of course support Fontconfig.  I am not sure
what the impact of doing so (e.g. run-time performance) is.  I have
not studied it at all.

Bob

#1019717#40
Date:
2024-03-07 08:42:22 UTC
From:
To:
Grüße!!

Ich bin Patricia Daniel.
Ich brauche Ihre Unterstützung, um in Ihr Land zu ziehen,
damit ich investieren und meine Ausbildung fortsetzen kann.

Freundliche Grüße,
Patricia.