kakwa / libvisio2svg

Library/Tools to convert Microsoft (MS) Visio documents (VSS and VSD) to SVG
GNU General Public License v2.0
112 stars 20 forks source link

ERROR: font.c (1334): wmf_ipa_font_map: failed to load *any* font! #25

Closed zeysh closed 5 years ago

zeysh commented 5 years ago

Hi,

I can't fix an issue with the wmf API.

When I try to convert a vss file I got this message. Looks like an issue with libwmf and map fonts.

vss2svg-conv -i X430.vss 
ERROR: font.c (1334): wmf_ipa_font_map: failed to load *any* font!

I tried on Arch with this https://aur.archlinux.org/packages/libvisio2svg/ And on Debian with

apt update
apt install -y gcc g++ make cmake libpng-dev libc6-dev libfontconfig1-dev libfreetype6-dev git libxml2-dev libwmf-dev libtool automake libvisio-dev libboost1.55-dev libcppunit-dev wget unzip doxygen

git clone https://github.com/kakwa/libvisio2svg.git /root/libvisio2svg
git clone https://github.com/kakwa/libemf2svg.git /root/libemf2svg
git clone http://git.code.sf.net/p/libwpd/librevenge /root/librevenge

cd /root/libemf2svg
cmake . -DCMAKE_INSTALL_PREFIX=/usr/
make
make install

cd /root/librevenge
./autogen.sh
./configure
make
make install

cd /root/libvisio2svg
cmake . -DCMAKE_INSTALL_PREFIX=/usr/
make
make install

Have I miss something? Many thanks

kakwa commented 5 years ago

Interesting bug, it seems to be a quite common issue for software using libwmf.

Googling the error message, I got error in imagemagik, gimp and inkscape.

From stracing things, it looks like libwmf is trying to load fonts in '/usr/share/fonts/type1/gsfonts':

strace -f -e file vss2svg-conv -i X430.vss -o out 2>&1 | grep font
open("/usr/lib/x86_64-linux-gnu/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/var/lib/ghostscript/fonts/Fontmap", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("//usr/share/fonts/type1/gsfonts/n021003l.pfb", {st_mode=S_IFREG|0644, st_size=101374, ...}) = 0
stat("//usr/share/fonts/type1/gsfonts/n021003l.afm", {st_mode=S_IFREG|0644, st_size=43432, ...}) = 0
stat("//usr/share/fonts/type1/gsfonts/n021003l.pfb", {st_mode=S_IFREG|0644, st_size=101374, ...}) = 0
open("//usr/share/fonts/type1/gsfonts/n021003l.pfb", O_RDONLY) = 4
stat("//usr/share/fonts/type1/gsfonts/n021003l.afm", {st_mode=S_IFREG|0644, st_size=43432, ...}) = 0
open("//usr/share/fonts/type1/gsfonts/n021003l.afm", O_RDONLY) = 4
open("/var/lib/ghostscript/fonts/Fontmap", O_RDONLY) = -1 ENOENT (No such file or directory)
[...]

This directory belongs to the package gsfonts under Debian, and this package is only tagged as "recommended" and will not be systematically installed on minimal setups.

Under Debian, installing gsfonts should solve the issue. Not sure about the package name under Arch, but it should be quite similar.

I will complete the documentation to mention this requirement.

I was unfortunately not aware of this hidden dependency, I tend to be lazy and let recommended packages be installed automatically on my machines, so my systems are not as minimal as yours.

Thanks for reporting the issue.

kakwa commented 5 years ago

I've updated the documentation.

Could you confirm installing gsfonts fixed the issue? It should work but I'm not 100% certain I'm not missing something else.

zeysh commented 5 years ago

Hi,

Works perfectly on Debian with gsfonts package. But not with Arch. gsfonts package install fonts in /usr/share/fonts/gsfonts/

ls /usr/share/fonts/gsfonts/
C059-BdIta.otf           NimbusRoman-Bold.otf    NimbusSansNarrow-BoldOblique.otf  URWBookman-DemiItalic.otf
C059-Bold.otf            NimbusRoman-BoldItalic.otf  NimbusSansNarrow-Oblique.otf      URWBookman-Light.otf
C059-Italic.otf          NimbusRoman-Italic.otf  NimbusSansNarrow-Regular.otf      URWBookman-LightItalic.otf
C059-Roman.otf           NimbusRoman-Regular.otf     P052-Bold.otf             URWGothic-Book.otf
D050000L.otf             NimbusSans-Bold.otf     P052-BoldItalic.otf           URWGothic-BookOblique.otf
NimbusMonoPS-Bold.otf        NimbusSans-BoldItalic.otf   P052-Italic.otf           URWGothic-Demi.otf
NimbusMonoPS-BoldItalic.otf  NimbusSans-Italic.otf   P052-Roman.otf            URWGothic-DemiOblique.otf
NimbusMonoPS-Italic.otf      NimbusSans-Regular.otf  StandardSymbolsPS.otf         Z003-MediumItalic.otf
NimbusMonoPS-Regular.otf     NimbusSansNarrow-Bold.otf   URWBookman-Demi.otf

but libwmf is trying to load fonts in /usr/share/fonts/Type1

x430-visio-stencil]# strace -f -e file vss2svg-conv -i X430.vss -o out 2>&1 | grep font
openat(AT_FDCWD, "/usr/lib/libfontconfig.so.1", O_RDONLY|O_CLOEXEC) = 3
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!
stat("/usr/share/fonts/Type1/NimbusRoman-Regular.t1", 0x7ffeeeb20060) = -1 ENOENT (No such file or directory)
ERROR: font.c (1339): wmf_ipa_font_map: failed to load *any* font!

I close this issue. Many thanks for your help Have a nice day