emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/fontaine 28ce11c287 1/4: Add support for the fixed-pitc


From: ELPA Syncer
Subject: [elpa] externals/fontaine 28ce11c287 1/4: Add support for the fixed-pitch-serif face
Date: Sun, 10 Jul 2022 02:57:34 -0400 (EDT)

branch: externals/fontaine
commit 28ce11c2874393ce02ee959239bbc6af7eccec9f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add support for the fixed-pitch-serif face
---
 fontaine.el | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/fontaine.el b/fontaine.el
index 4146c735fb..a2ee05606e 100644
--- a/fontaine.el
+++ b/fontaine.el
@@ -202,6 +202,11 @@ The properties in detail:
   fallback values are `:default-family', `:default-weight', and
   1.0, respectively.
 
+- `:fixed-pitch-serif-family', `:fixed-pitch-serif-weight',
+  `:fixed-pitch-serif-height' apply to the `fixed-pitch-serif'
+  face.  Their fallback values are `:default-family',
+  `:default-weight', and 1.0, respectively.
+
 - The `:variable-pitch-family', `:variable-pitch-weight', and
   `:variable-pitch-height' apply to the `variable-pitch' face.
   They all fall back to the respective default values, as
@@ -260,6 +265,10 @@ Caveats or further notes:
                   ((const :tag "Fixed pitch regular weight" 
:fixed-pitch-weight) ,fontaine--weights-widget)
                   ((const :tag "Fixed pitch height" :fixed-pitch-height) float)
 
+                  ((const :tag "Fixed pitch serif font family" 
:fixed-pitch-serif-family) string)
+                  ((const :tag "Fixed pitch serif regular weight" 
:fixed-pitch-serif-weight) ,fontaine--weights-widget)
+                  ((const :tag "Fixed pitch serif height" 
:fixed-pitch-serif-height) float)
+
                   ((const :tag "Variable pitch font family" 
:variable-pitch-family) string)
                   ((const :tag "Variable pitch regular weight" 
:variable-pitch-weight) ,fontaine--weights-widget)
                   ((const :tag "Variable pitch height" :variable-pitch-height) 
float)
@@ -398,6 +407,16 @@ ARGS are its routines."
   (or (plist-get properties :fixed-pitch-height) 1.0)
   frame))
 
+(fontaine--apply-preset
+ fontaine--apply-fixed-pitch-serif-preset
+ "Set `fixed-pitch-serif' face attributes based on PRESET for optional FRAME."
+ (fontaine--set-face-attributes
+  'fixed-pitch-serif
+  (or (plist-get properties :fixed-pitch-family) (plist-get properties 
:default-family))
+  (or (plist-get properties :fixed-pitch-weight) (plist-get properties 
:default-weight))
+  (or (plist-get properties :fixed-pitch-height) 1.0)
+  frame))
+
 (fontaine--apply-preset
  fontaine--apply-variable-pitch-preset
  "Set `variable-pitch' face attributes based on PRESET for optional FRAME."
@@ -481,6 +500,7 @@ non-nil."
       (user-error "Cannot use this in a terminal emulator; try the Emacs GUI")
     (fontaine--apply-default-preset preset frame)
     (fontaine--apply-fixed-pitch-preset preset frame)
+    (fontaine--apply-fixed-pitch-serif-preset preset frame)
     (fontaine--apply-variable-pitch-preset preset frame)
     (fontaine--apply-bold-preset preset frame)
     (fontaine--apply-italic-preset preset frame)
@@ -491,7 +511,7 @@ non-nil."
 ;;;; Modify individual faces
 
 (defconst fontaine--font-faces
-  '(default fixed-pitch variable-pitch bold italic)
+  '(default fixed-pitch fixed-pitch-serif variable-pitch bold italic)
   "List of faces whose typographic attributes we may change.")
 
 (defconst fontaine--font-weights
@@ -575,8 +595,10 @@ Target FRAME, if provided as an optional argument."
 (defvar fontaine--fixed-pitch-font-family-history '()
   "Minibuffer history of selected `fixed-pitch' font families.")
 
-(defun fontaine--set-fixed-pitch (&optional frame)
-  "Set `fixed-pitch' attributes, optionally for FRAME."
+(defun fontaine--set-fixed-pitch (&optional frame serif)
+  "Set `fixed-pitch' attributes, optionally for FRAME.
+If optional SERIF is non-nil, operate on the `fixed-pitch-serif'
+face."
   (let* ((families (or (alist-get 'fixed-pitch fontaine-font-families)
                        (fontaine--family-list-fixed-pitch)))
          (family (completing-read "Font family of `fixed-pitch': "
@@ -585,9 +607,10 @@ Target FRAME, if provided as an optional argument."
          (weight (intern (completing-read "Select weight for `fixed-pitch': "
                                           fontaine--font-weights nil)))
          (height (read-number "Height of `fixed-pitch' face (must be a 
floating point): "
-                              1.0 'fontaine--float-history)))
+                              1.0 'fontaine--float-history))
+         (face (if serif 'fixed-pitch-serif 'fixed-pitch)))
     (if (floatp height)
-        (fontaine--set-face-attributes 'fixed-pitch family weight height frame)
+        (fontaine--set-face-attributes face family weight height frame)
       (user-error "Height of `fixed-pitch' face must be a floating point"))))
 
 (defvar fontaine--variable-pitch-font-family-history '()
@@ -665,6 +688,7 @@ non-nil."
     ('bold (fontaine--set-bold frame))
     ('default (fontaine--set-default frame))
     ('fixed-pitch (fontaine--set-fixed-pitch frame))
+    ('fixed-pitch-serif (fontaine--set-fixed-pitch frame :serif))
     ('italic (fontaine--set-italic frame))
     ('variable-pitch (fontaine--set-variable-pitch frame))
     (_ (call-interactively #'fontaine-set-preset))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]