From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58041: [PATCH] docview: Use svg images when using mupdf for conversion Date: Thu, 12 Jan 2023 11:33:49 -0500 Message-ID: References: <87k05t848c.fsf@gmail.com> <87eds5zhf7.fsf@gmail.com> <87v8lfy8g5.fsf@gmail.com> <87fscgxng0.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24261"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58041@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 12 17:36:07 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 1pG0Yg-0005ar-Je for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Jan 2023 17:36:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pG0Xp-00016B-3i; Thu, 12 Jan 2023 11:35:13 -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 1pG0Xe-00014b-Vr for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:35:03 -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 1pG0Xe-0007dE-KO for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pG0Xe-0000xg-G9 for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jan 2023 16:35:02 +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.16735412463597 (code B ref 58041); Thu, 12 Jan 2023 16:35:02 +0000 Original-Received: (at 58041) by debbugs.gnu.org; 12 Jan 2023 16:34:06 +0000 Original-Received: from localhost ([127.0.0.1]:48450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG0Wj-0000vw-Jf for submit@debbugs.gnu.org; Thu, 12 Jan 2023 11:34:05 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG0Wf-0000vE-CQ for 58041@debbugs.gnu.org; Thu, 12 Jan 2023 11:34:02 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 09D6880D0F; Thu, 12 Jan 2023 11:33:56 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 192148056A; Thu, 12 Jan 2023 11:33:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1673541234; bh=Q+yI2hhBjW94sKLYLE/dJq8si4yXRziy5PejLVyNeRo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DsEfE0DhSj5rHbt42q9sR6+VPXN4XlDfEwS6qxALd6R7iDrs5kWs5AkJBLYqVe6DG WAoDw57OIvX815HAWzr7DFjA9xHmO0A2yHWlmuC6dv+/yD647V0fUX9cHetLcez4ti H6wfiac/+lgoG+dsDLdJlkMdYF1rs5RV4TRmJD2RoFgUHfktj/6k/ntmQGySoMXpK9 TfwuJ4ftJETN//A6Hpg6odC9hvPy/KTgZIsjNFk7Bpiv2mfVjosKeMiJ+bcJmlCjPa bYbtln72jbc0ddtV0uxTA20Y8G9RUc/+hGA8CNkbMydYjoy21P2JM3VwECBa8DguHg P9+7lMkIZiy7g== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0559D1202FB; Thu, 12 Jan 2023 11:33:54 -0500 (EST) In-Reply-To: <87fscgxng0.fsf@gmail.com> (Visuwesh's message of "Thu, 12 Jan 2023 12:13:27 +0530") 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:253237 Archived-At: > --- 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? >> 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. Stefan