Guillaume Munch wrote: > Le 27/04/2016 21:42, Georg Baum a écrit : >> Guillaume Munch wrote: >> >>> Is there a criteria to detect "bad" svg converters (at least some of >>> them)? In the other message you wrote about "explicit svg->png >>> converter". What does explicit mean? >> >> explicit means "no default", e.g. either a manually defined one, or one >> found by confugure.py. My reasoning would be that the ones in >> configure.py work well, and if a user defines a converter manually we can >> safely assume that it will be better than lib/scripts/convertDefault.py. >> >>> I experienced it with about 20 svg images and it went as you describe: >>> computation in the background, delays the first time the previews are >>> displayed. I can imagine how it would be annoying with many more images >>> and no converter cache. Are there reasons to turn off the cache? >> >> privacy concerns maybe: If you temporarily edit a doc with images (from a >> USB stick) it will leave traces if the cache is enabled. I vaguely >> remember a report where a user did not like the cache at all, but I don't >> remember the reasons unfortunately. >> >>> If the issues are the delays and the scrolling impedance, then here's a >>> workaround (not for 2.2.0 obviously): display the qt version until the >>> preview is ready. >> >> Or supressing the qt builtin svg only if the converter cache is enabled. >> > > The latter idea is implemented in the attached. For your first idea, I > will need your input.
Attached is a combined version. While testing, I found out that svgz appears as an extra format in the qt format list as well, so I removed that also. Georg
diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 6fb5499..d990b33 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -35,6 +35,7 @@ #include "BufferView.h" #include "CmdDef.h" #include "Color.h" +#include "Converter.h" #include "CutAndPaste.h" #include "ErrorList.h" #include "Font.h" @@ -232,9 +233,20 @@ vector<string> loadableImageFormats() LYXERR(Debug::GRAPHICS, (const char *) *it << ", "); string ext = ascii_lowercase((const char *) *it); - // special case + // special cases if (ext == "jpeg") ext = "jpg"; + else if (lyxrc.use_converter_cache && + (ext == "svg" || ext == "svgz") && + theConverters().isReachable("svg", "png")) + // Qt only supports SVG 1.2 tiny. See #9778. We prefer displaying + // the SVG as in the output. However we require that the converter + // cache is enabled since this is expensive. We also require that + // an explicit svg->png converter is defined, since the default + // converter could produce bad quality as well. This assumes that + // png can always be loaded. + continue; + fmts.push_back(ext); }