chiark / gitweb /
el/dot-emacs.el: Print buffers in a condensed version of Courier.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 20 May 2021 17:40:33 +0000 (18:40 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 20 May 2021 17:40:33 +0000 (18:40 +0100)
el/dot-emacs.el

index 2a19ad1b30c87d90f29e1c76661636c899892a30..5a4923b71e9d83e61f7f8ab67b2286d1ee08c28e 100644 (file)
@@ -1361,6 +1361,36 @@ (defun mdw-standard-fill-prefix (rx &optional mat)
 ;;;--------------------------------------------------------------------------
 ;;; Printing.
 
+;; Teach PostScript about a condensed variant of Courier.  I'm using 85% of
+;; the usual width, which happens to match `mdwfonts', and David Carlisle's
+;; `pslatex'.  (Once upon a time, I used 80%, but decided consistency with
+;; `pslatex' was useful.)
+(setq ps-user-defined-prologue "
+/CourierCondensed /Courier
+/CourierCondensed-Bold /Courier-Bold
+/CourierCondensed-Oblique /Courier-Oblique
+/CourierCondensed-BoldOblique /Courier-BoldOblique
+  4 { findfont [0.85 0 0 1 0 0] makefont definefont pop } repeat
+")
+
+;; Hack `ps-print''s settings.
+(eval-after-load 'ps-print
+  '(progn
+
+     ;; Teach `ps-print' about my condensed varsions of Courier.
+     (setq ps-font-info-database
+            (append '((CourierCondensed
+                       (fonts (normal . "CourierCondensed")
+                              (bold . "CourierCondensed-Bold")
+                              (italic . "CourierCondensed-Oblique")
+                              (bold-italic . "CourierCondensed-BoldOblique"))
+                       (size . 10.0)
+                       (line-height . 10.55)
+                       (space-width . 5.1)
+                       (avg-char-width . 5.1)))
+                    (cl-remove 'CourierCondensed ps-font-info-database
+                               :key #'car)))))
+
 ;; Arrange to strip overlays from the buffer before we print .  This will
 ;; prevent `flyspell' from interfering with the printout.  (It would be less
 ;; bad if `ps-print' could merge the `flyspell' overlay face with the