Comment 2 for bug 2004188

Revision history for this message
Pavel Kopylov (pkopylov) wrote :

I did some investigation.
So, the problem is located into the convert utility:

------------ Begin console output ----------------
root@unassigned-hostname:~# convert label:aaa x.png
convert-im6.q16: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1367.
convert-im6.q16: no images defined `x.png' @ error/convert.c/ConvertImageCommand/3258.
------------- End console output -----------------

I started the utility mentioned above with strace and noticed that an unsuccessful attempt to open "helvetica" file leads to failure. This file is used without any absolute path, so I think it is the issue, for instance, all other files are opened using an absolute path.

------- Begin strace output (grepped by openat) --
openat(AT_FDCWD, "/usr/share/fonts/truetype", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/var/cache/fontconfig//7ef2298fde41cc6eeb7af42e48b7d293-le64.cache-7", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/fonts/truetype/dejavu", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/var/cache/fontconfig//d589a48862398ed80a3d6066f4f56f4c-le64.cache-7", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "helvetica", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/ImageMagick-6/locale.xml", O_RDONLY) = 3
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7//config-Q16/locale.xml", O_RDONLY) = -1 ENOENT
------------- End strace output -----------------

So, I found "helvetica" word in the lib libMagickCore-6.Q16.so.3 which is loaded according to the strace output. Moreover, I found a xml-fragment inside this library:

------------- XML inside the library--------------
<?xml version="1.0"?><typemap> <type stealth="True" name="fixed" family="helvetica"/> <type stealth="True" name="helvetica" family="helvetica"/></typemap>
--------------------------------------------------

I am absolutely sure that this XML fragment is the key to the issue because things changed completely after I had corrected the word "helvetica" to "helvetixa" in the fragment (yes, I did it inside the binary file). So when the family is corrected as mentioned before, the convert utility works well. Right now, I don't understand why, but I am going to solve this problem.

In the end, I listed the font known by convert. There are several available fonts, but helvetica is not mentioned below:

------------ Begin console output ----------------
root@unassigned-hostname:~# convert -list font

Path: System Fonts
  Font: DejaVu-Sans
    family: DejaVu Sans
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
  Font: DejaVu-Sans-Bold
    family: DejaVu Sans
    style: Normal
    stretch: Normal
    weight: 700
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
  Font: DejaVu-Sans-Mono
    family: DejaVu Sans Mono
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
  Font: DejaVu-Sans-Mono-Bold
    family: DejaVu Sans Mono
    style: Normal
    stretch: Normal
    weight: 700
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
  Font: DejaVu-Serif
    family: DejaVu Serif
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
  Font: DejaVu-Serif-Bold
    family: DejaVu Serif
    style: Normal
    stretch: Normal
    weight: 700
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf

------------- End console output -----------------

And there is no helvetica font in the /usr/share/fonts/truetype directory:

------------ Begin console output ----------------
root@unassigned-hostname:/usr/share/fonts/truetype/dejavu# ls -l
total 2816
-rw-r--r-- 1 root root 705684 Jul 30 2016 DejaVuSans-Bold.ttf
-rw-r--r-- 1 root root 331992 Jul 30 2016 DejaVuSansMono-Bold.ttf
-rw-r--r-- 1 root root 340712 Jul 30 2016 DejaVuSansMono.ttf
-rw-r--r-- 1 root root 757076 Jul 30 2016 DejaVuSans.ttf
-rw-r--r-- 1 root root 356088 Jul 30 2016 DejaVuSerif-Bold.ttf
-rw-r--r-- 1 root root 380132 Jul 30 2016 DejaVuSerif.ttf
------------- End console output -----------------

By the way, could you please check the content of that path on your VM where things work right?