Subject: bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion

From: Stefan Monnier <[email-masked]>
Date: Mon, 09 Jan 2023 09:51:42 -0500

>>> Attached patch makes mupdf produce svg images rather than png when svg
>>> support is available.  This makes a noticeable improvement in image
>>> quality when zooming in.
>> IIUC this means that `+` and `-` now don't need to re-process the PDF, right?
>> I think this is particularly valuable for things like ODT where `+/-`
>> was pretty slow (because it re-created the PDF each time before having
>> a chance to focus on the current page).
> It depends on the value of `doc-view-scale-internally'.  The default
> value (t) implies that we change the :width image property which leads
> to blurry images when zooming.  In my case, even without zooming in, the
> image quality was noticeably worse.

So `doc-view-scale-internally` should default to nil when we use SVGs, right?

> If `doc-view-scale-internally' is nil though, what you say happens.

IIUC you're saying here that when `doc-view-scale-internally` is nil we
re-create the SVGs every time the users try to zoom in/out?  While not
strictly a bug, it's a significant inefficiency we should address, no?

Another thing that's odd now is that we use
`doc-view-pdf->png-converter-function` to convert to SVG, despite
its name.

>> Other reasons it's worth mentioning in NEWS is because there's a new
>> Custom to control it, and because it causes a regression for those LaTeX
>> files which end up embedding bitmap fonts.  I just bumped into one and
>> couldn't understand why every page took almost a minute to load;
>> Removing `\usepackage[T1]{fontenc}` fixed the problem.
> For the most part, I assumed MuPDF's svg and png conversion was
> one-to-one.  My testing with small docx and Excel files went smooth so I
> didn't think this feature warranted a NEWS entry.

I don't know exactly what happens with those LaTeX-generated PDF files,
indeed.  I haven't bumped into the problem with any other PDF files yet
(including scans).  But those PDF files with embedded bitmap fonts used
the be the norm in the LaTeX world in some distant past, so I'm sure
some of our users will bump into them.

        Stefan