Well, I managed to make a patch which seems to work, but, as usual, I need you
to test it.

This is my solution: when we open a document all the snippets are put together
in a unique LaTeX file. Then we parse the DVI (the DTL created with dv2dt
actually) looking for pages containing literal PostScript, when we find one, we
remove its content and leave a blank page with just font definitions (DVI is
pretty straightforward!). Then we give the stripped DVI to dvipng. Finally we
create a new LaTeX file containing all the snippets we removed and give it to
the legacy method.
If the DVI doesn't contain any PostScript page, it passes just through dvipng,
viceversa if all the pages contain PostScript it goes directly to the legacy
method.
The last step is to create a .metrics file containing the correct (mixed from
the two methods) information, skipping the pages that failed. Then on the C++
side we simply ignore those snippets not appearing in the .metrics file or in
any case without an actual output.

In LyX the result is that when you open a document all the images are loaded
(dvipng does that quick work and legacy the hard) apart from those which failed
(TikZ for example, see the other thread).

I've attached the patch [1] and an archive [2] containing a test file. I've also
tested the math manual and works fine. It works with the current trunk revision.
Hope you like it and... suggestions are welcome!

venom00

P.S. dt2dv is a new dependency! Not to be confused with dv2dt.

[1] http://www.lyx.org/trac/attachment/ticket/6720/ip_error_handling.diff
[2] http://www.lyx.org/trac/attachment/ticket/6720/tests.zip

Reply via email to