diff options
-rw-r--r-- | README.rst | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -64,7 +64,7 @@ file: .. code:: elisp (defun my-nov-font-setup () - (face-remap-add-relative 'variable-pitch :family "Liberation Serif")) + (face-remap-add-relative 'variable-pitch :font "Liberation Serif-14")) (add-hook 'nov-mode-hook 'my-nov-font-setup) To completely disable the variable pitch font, customize @@ -102,6 +102,37 @@ function by customizing ``nov-render-html-function`` to one that replaces HTML in a buffer with something nicer than the default output. +Here's an advanced example of text justification with the `justify-kp +<https://github.com/Fuco1/justify-kp>`_ package: + +.. code:: elisp + + (setq nov-text-width most-positive-fixnum) + + (defun my-nov-window-configuration-change-hook () + (my-nov-post-html-render-hook) + (remove-hook 'window-configuration-change-hook + 'my-nov-window-configuration-change-hook + t)) + + (defun my-nov-post-html-render-hook () + (if (get-buffer-window) + (let ((max-width (pj-line-width)) + buffer-read-only) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (goto-char (line-end-position)) + (when (> (shr-pixel-column) max-width) + (goto-char (line-beginning-position)) + (pj-justify)) + (forward-line 1)))) + (add-hook 'window-configuration-change-hook + 'my-nov-window-configuration-change-hook + nil t))) + + (add-hook 'nov-post-html-render-hook 'my-nov-post-html-render-hook) + Usage ----- |