From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion Date: Mon, 09 Jan 2023 22:02:58 +0530 Message-ID: <87v8lfy8g5.fsf@gmail.com> References: <87k05t848c.fsf@gmail.com> <87eds5zhf7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39302"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58041@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 09 17:34:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEv6K-000A0A-9E for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 Jan 2023 17:34:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEv63-0004PE-QX; Mon, 09 Jan 2023 11:34:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEv62-0004P1-07 for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2023 11:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEv61-0004YV-OH for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2023 11:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pEv61-0002fN-Ja for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2023 11:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jan 2023 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58041 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58041-submit@debbugs.gnu.org id=B58041.167328198910188 (code B ref 58041); Mon, 09 Jan 2023 16:34:01 +0000 Original-Received: (at 58041) by debbugs.gnu.org; 9 Jan 2023 16:33:09 +0000 Original-Received: from localhost ([127.0.0.1]:38042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEv5B-0002eG-99 for submit@debbugs.gnu.org; Mon, 09 Jan 2023 11:33:09 -0500 Original-Received: from mail-pf1-f193.google.com ([209.85.210.193]:39766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEv59-0002e3-El for 58041@debbugs.gnu.org; Mon, 09 Jan 2023 11:33:07 -0500 Original-Received: by mail-pf1-f193.google.com with SMTP id a30so6545649pfr.6 for <58041@debbugs.gnu.org>; Mon, 09 Jan 2023 08:33:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cl1xj7FxhkflY3hRSN1xuW+usSt6/N71bRZO45MMh2A=; b=pEAfs4pcB+b1rVSMjvDvnhLtrQBaTGU6LuxfY43E+9dolN+yeVxF5HVeBL+B52BFqU CTzvNMHoD9MMuqrHJ776iM033ukerPfqZWiHaQUNiE3qra+OlqN0Nn9av/lTpGxTwrI9 BesVljWNVkxdyYZQwCPO8+ARjB6Kikg83QvZS5agbCFFoZmPsL67JqcF+mrebJUjKIN1 9xRguOj2E48RpT3q/v/r4xeq5wXydYpbHfKc6tUm45eFY4nulqHL2/nHoxM9kiOEBJhl 6sTa6JwACeKwfdiJ7shAa1rGeWxrdfHjucQh4IbBjydT/JNOYvXKzy2dj60QetJzDcj1 4QZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cl1xj7FxhkflY3hRSN1xuW+usSt6/N71bRZO45MMh2A=; b=eiRxbOOV1tfM6Y+HAIB9vAt/XBe2yAg4nnLOd3hQqsHI8wcMc4kUauf5RdPu7794+C p9v5uc0JT+RW7HwRy7sf2SOj1jg6MSU559aKDigBK4+y2e581vBY8o71x352EdQXqCeR e7rn3EizSshooB0I27GaxBV7fwr1YkdiZNvJBTbT9Ovjis/IvJlWesQ8Je0U2zZXHFB3 d9I45lsAqdg7IkpzG8TEIH3o7NRa+7bL2EJnLi6IKTqiZG5Q9uI5qHbaQC5GRfRdHQfg j+Flk6XxmkA+rtra9L9Fn9lQBWT9Lcp3eLfSrUCNAGfln573x7yT2IsRL8IA8dCituw/ vfwQ== X-Gm-Message-State: AFqh2kr98ee1w5tGz9kPYswcjyOIstgpIe/l5cg3OnaN/+Npc0VixwHV mBzpT6LjqQgXtAOiGl2wN9c= X-Google-Smtp-Source: AMrXdXu9FaOYWxDUkuZdn1RZ+FqvmjYTFhJqIx3Ddj1zAbis0UqUr/6synQSIPaZ5Q4vM2lb+cqU6A== X-Received: by 2002:a05:6a00:e16:b0:581:12c5:1356 with SMTP id bq22-20020a056a000e1600b0058112c51356mr43942815pfb.30.1673281981618; Mon, 09 Jan 2023 08:33:01 -0800 (PST) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id c135-20020a624e8d000000b005818643be3fsm6222824pfb.206.2023.01.09.08.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 08:33:01 -0800 (PST) In-Reply-To: (Stefan Monnier via's message of "Mon, 09 Jan 2023 09:51:42 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253029 Archived-At: [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0=AE=9C= =E0=AE=A9=E0=AE=B5=E0=AE=B0=E0=AE=BF 09, 2023] Stefan Monnier via "Bug repo= rts 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, ri= ght? 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