bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Visuwesh
Subject: bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion
Date: Mon, 09 Jan 2023 22:02:58 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[திங்கள் ஜனவரி 09, 2023] Stefan Monnier via "Bug reports for GNU Emacs, the 
Swiss army knife of text editors" wrote:

>>> 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?

It should default to t, which is the case currently.

>> 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?

I suppose so.  But I'm not really sure if users out in the wild adjust
the variable.  If they do, then it might be worth looking into ignoring
that variable if we're generating SVG images.

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

It felt like a waste to create a separate pdf->svg function since it
would contain the same exact BODY of mupdf pdf->png function since we
only change the PNG argument to end with a .svg extension at the caller
site (see doc-view-set-up-single-converter).
[ And AFAIK, mupdf is the only program that can convert pdf->svg (hence
  'mupdf' in the new defcustom's 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.

>From your report and the other recent one about buggy svg files, it
would be nice if we could gracefully fall back to png image generation
if there was an error during the conversion process but I currently
don't have the time to understand doc-view to propose such a patch.

In any case, what do you all think about the following NEWS entry?

    * doc-view generates SVG images when viewing PDF files if possible.
    If Emacs is built with SVG support, doc-view defaults to generating SVG
    files when using MuPDF as the converter for PDF files.  To get the old
    behaviour, set 'doc-view-mupdf-use-svg' to nil.
    Note that MuPDF SVG generation is known to be buggy for certain files.

>
>         Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]