[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: |
Thu, 12 Jan 2023 22:17:50 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
[வியாழன் ஜனவரி 12, 2023] Stefan Monnier via "Bug reports for GNU Emacs, the
Swiss army knife of text editors" wrote:
>> --- a/lisp/doc-view.el
>> +++ b/lisp/doc-view.el
>> @@ -921,7 +921,7 @@ doc-view-shrink-factor
>> (defun doc-view-enlarge (factor)
>> "Enlarge the document by FACTOR."
>> (interactive (list doc-view-shrink-factor))
>> - (if doc-view-scale-internally
>> + (if (or doc-view-scale-internally doc-view-mupdf-use-svg)
>> (let ((new (ceiling (* factor doc-view-image-width))))
>> (unless (equal new doc-view-image-width)
>> (setq-local doc-view-image-width new)
>> @@ -941,7 +941,7 @@ doc-view-shrink
>> (defun doc-view-scale-reset ()
>> "Reset the document size/zoom level to the initial one."
>> (interactive)
>> - (if doc-view-scale-internally
>> + (if (or doc-view-scale-internally doc-view-mupdf-use-svg)
>> (progn
>> (kill-local-variable 'doc-view-image-width)
>> (doc-view-insert-image
>
> Hmm.... `doc-view-mupdf-use-svg` means "use SVG when the backend
> is mupdf" but we don't know here whether the backend is mupdf, so this
> will misfire when using something else than mupdf, no?
Ah yes, of course. Somehow, I managed to completely forget about the
other file formats supported by doc-view like djvu (since I only use
file formats that use mupdf in the end). How about the below revised
patch?
0001-Use-internal-image-scaling-when-using-SVG-images-in-.patch
Description: Text Data
This does the expected on my end with doc-view-scale-internally to nil:
when visiting a djvu file and zooming in, it regenerates the images;
when visiting a docx file and zooming in, it modifies the :width image
property (i.e., no regeneration).
>>> I wasn't thinking of duplicating the code, but of rethinking the naming
>>> a bit. I think what we meant by "pdf->png" is actually the process that
>>> extracts pages (which just happened to use the PNG format and now can
>>> also use the SVG format).
>
>> Indeed, it is a misleading name. This change will have to go to master,
>> I believe? I have to look around a bit more to see where the function
>> is being used.
>> There's also the fact that there's more than one more program that can
>> generate SVG files (as Gregory pointed out in this thread) so it might
>> be nice to have pdf->png and pdf->svg "function variables" and a "super
>> function" that actually does the job. Hopefully, this will allow to
>> fall back gracefully to PNG if SVG generation is faulty.
>
> Indeed, I think there's some cleanup/orthogonalization in order here.
When I have more time and familiarity, I will try to give this a shot.
> Stefan
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, (continued)
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Stefan Monnier, 2023/01/09
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Visuwesh, 2023/01/09
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Gregory Heytings, 2023/01/09
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Stefan Monnier, 2023/01/09
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Visuwesh, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Eli Zaretskii, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Visuwesh, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Eli Zaretskii, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Stefan Monnier, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Stefan Monnier, 2023/01/12
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion,
Visuwesh <=
- bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion, Stefan Monnier, 2023/01/12