unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kjartan Oli Agustsson <kjartanoli@outlook.com>
To: Kjartan Oli Agustsson <kjartanoli@outlook.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Daniel Nicolai <dalanicolai@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: [PATCH] Add user stylesheet support for doc-view EPUB support
Date: Mon, 07 Mar 2022 00:50:18 +0000	[thread overview]
Message-ID: <GV1P193MB2310407DD82447436468B193DF089@GV1P193MB2310.EURP193.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P193MB231053177EAED78773CAF29EDF089@GV1P193MB2310.EURP193.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]


Kjartan Oli Agustsson <kjartanoli@outlook.com> writes:

> I'll see if I can't handle this there, and submit a new patch once I get
> that to work.

This should take care of that.  But now there's something else I'm
wondering about.  If I'm understanding
`doc-view-custom-set-epub-font-size' correctly, it is used as the setter
for `doc-view-epub-font-size' to regenerate epub documents when it is
changed.  Am I understanding this correctly, and if so would it make
sense to do the same for the user stylesheet?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Improved patch --]
[-- Type: text/x-patch, Size: 1885 bytes --]

From eae132bde6d25a7fa1125bb47c1971c93d4bc300 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kjartan=20=C3=93li=20=C3=81g=C3=BAstsson?=
 <kjartanoli@outlook.com>
Date: Mon, 7 Mar 2022 00:48:32 +0000
Subject: [PATCH] Add user stylesheet option for doc-view EPUB support

* lisp/doc-view.el (doc-view-start-process): Add user stylesheet to
process arguments when appropriate.
---
 lisp/doc-view.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 193cf42ea4..1ea3443667 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -226,6 +226,12 @@ doc-view-resolution
 Higher values result in larger images."
   :type 'number)
 
+(defcustom doc-view-mutool-user-stylesheet nil
+  "User stylesheet to use when converting EPUB documents to PDF."
+  :type '(choice (const nil)
+                 (file :must-match t))
+  :version "29.1")
+
 (defvar doc-view-doc-type nil
   "The type of document in the current buffer.
 Can be `dvi', `pdf', `ps', `djvu', `odf', 'epub', `cbz', `fb2',
@@ -1169,8 +1175,11 @@ doc-view-pdf->png-converter-mupdf
          (options `(,(concat "-o" png)
                     ,(format "-r%d" (round doc-view-resolution))
                     ,@(if pdf-passwd `("-p" ,pdf-passwd)))))
-    (when (and (eq doc-view-doc-type 'epub) doc-view-epub-font-size)
-      (setq options (append options (list (format "-S%s" doc-view-epub-font-size)))))
+    (when (eq doc-view-doc-type 'epub)
+      (when doc-view-epub-font-size
+        (setq options (append options (list (format "-S%s" doc-view-epub-font-size)))))
+      (when doc-view-mutool-user-stylesheet
+        (setq options (append options (list (format "-U%s" (expand-file-name doc-view-mutool-user-stylesheet)))))))
     (doc-view-start-process
      "pdf->png" doc-view-pdfdraw-program
      `(,@(doc-view-pdfdraw-program-subcommand)
-- 
2.35.1


[-- Attachment #3: Type: text/plain, Size: 35 bytes --]


-- 
Kjartan Óli Ágústsson


  reply	other threads:[~2022-03-07  0:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-06 17:12 [PATCH] Add user stylesheet support for doc-view EPUB support Kjartan Oli Agustsson
2022-03-06 22:07 ` Lars Ingebrigtsen
2022-03-07  0:17   ` Kjartan Oli Agustsson
2022-03-07  0:50     ` Kjartan Oli Agustsson [this message]
2022-03-07 16:31       ` Lars Ingebrigtsen
2022-03-08 23:06         ` Kjartan Oli Agustsson
2022-03-09 13:59           ` Lars Ingebrigtsen
2022-03-09 22:34             ` Kjartan Oli Agustsson
2022-03-12 16:40               ` Lars Ingebrigtsen
2022-03-14 10:25                 ` Kjartan Oli Agustsson
2022-03-14 10:32                   ` Lars Ingebrigtsen
2022-03-14 11:17                     ` Kjartan Oli Agustsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV1P193MB2310407DD82447436468B193DF089@GV1P193MB2310.EURP193.PROD.OUTLOOK.COM \
    --to=kjartanoli@outlook.com \
    --cc=dalanicolai@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).