summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wong <ben@wongs.net>2019-01-06 21:52:08 -0500
committerAaron M. Ucko <ucko@debian.org>2019-01-06 21:52:08 -0500
commitb266c5ac9aee1339212e20d4f3e3ba955499b7ac (patch)
tree4635956e747f4550034568842e7f582ec786e1ef
parenta23b8f4a422d0de69a006ed010eff5795319db98 (diff)
Support custom faces for definition bodies, preferably var-width.
Define and use a new dictionary-word-definition-face, which defaults to "DejaVu Serif", if that font family is supported. If that font isn't available and the display type is "X", "Sans Serif" is used. Otherwise, the default fonts are used.
-rw-r--r--dictionary.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/dictionary.el b/dictionary.el
index fa23546..6c00682 100644
--- a/dictionary.el
+++ b/dictionary.el
@@ -219,6 +219,16 @@ by the choice value:
(if (fboundp 'defface)
(progn
+ (defface dictionary-word-definition-face
+ '((((supports '(:family "DejaVu Serif")))
+ (:family "DejaVu Serif"))
+ (((type x))
+ (:font "Sans Serif"))
+ (t
+ (:font "default")))
+ "The face that is used for displaying the definition of the word."
+ :group 'dictionary)
+
(defface dictionary-word-entry-face
'((((type x))
(:italic t))
@@ -780,6 +790,7 @@ This function knows about the special meaning of quotes (\")"
(let ((start (point)))
(insert (dictionary-decode-charset reply dictionary))
(insert "\n\n")
+ (put-text-property start (point) 'face 'dictionary-word-definition-face)
(let ((regexp "\\({+\\)\\([^ '\"][^}]*\\)\\(}+\\)"))
(goto-char start)
(while (< (point) (point-max))