From eae132bde6d25a7fa1125bb47c1971c93d4bc300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjartan=20=C3=93li=20=C3=81g=C3=BAstsson?= 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