branch: externals/fontaine
commit fa76f238b5b039ad3a6f507c11a3934dd55016cb
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Add support for the tab-bar and tab-line faces
---
README.org | 30 ++++++++++++++++++++++++------
fontaine.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index dbb8c3b6ce..3272a563bf 100644
--- a/README.org
+++ b/README.org
@@ -71,17 +71,17 @@ Fontaine lets the user specify presets of font
configurations and set
them on demand on graphical Emacs frames. The user option
~fontaine-presets~ holds all such presets.
-[ The support for the mode line, header line, and line number faces is
- part of {{{development-version}}}. ]
+[ The support for the mode line, header line, line number, tab bar,
+ and tab line faces is part of {{{development-version}}}. ]
Presets consist of a list of properties that govern the family,
weight, and height of the faces ~default~, ~fixed-pitch~,
~fixed-pitch-serif~, ~variable-pitch~, ~mode-line-active~ (and
~mode-line~ for older Emacs version), ~mode-line-inactive~,
-~header-line~, ~line-number~, ~bold~, and ~italic~. Each preset is
-identified by a user-defined symbol as the car of a property list. It
-looks like this (check the default value of ~fontaine-presets~ for how
-everything is pieced together):
+~header-line~, ~line-number~, ~tab-bar~, ~tab-line~, ~bold~, and
+~italic~. Each preset is identified by a user-defined symbol as the
+car of a property list. It looks like this (check the default value of
+~fontaine-presets~ for how everything is pieced together):
#+begin_src emacs-lisp
(regular
@@ -119,6 +119,14 @@ everything is pieced together):
:line-number-weight nil ; falls back to :default-weight
:line-number-height 1.0
+ :tab-bar-family nil ; falls back to :default-family
+ :tab-bar-weight nil ; falls back to :default-weight
+ :tab-bar-height 1.0
+
+ :tab-line-family nil ; falls back to :default-family
+ :tab-line-weight nil ; falls back to :default-weight
+ :tab-line-height 1.0
+
:bold-family nil ; use whatever the underlying face has
:bold-weight bold
:italic-family nil
@@ -619,10 +627,20 @@ Remember to read the relevant doc strings.
:line-number-weight nil ; falls back to :default-weight
:line-number-height 0.9
+ :tab-bar-family nil ; falls back to :default-family
+ :tab-bar-weight nil ; falls back to :default-weight
+ :tab-bar-height 1.0
+
+ :tab-line-family nil ; falls back to :default-family
+ :tab-line-weight nil ; falls back to :default-weight
+ :tab-line-height 1.0
+
:bold-family nil ; use whatever the underlying face has
:bold-weight bold
+
:italic-family nil
:italic-slant italic
+
:line-spacing nil)))
;; Recover last preset or fall back to desired style from
diff --git a/fontaine.el b/fontaine.el
index e43b45cfea..b2806372f5 100644
--- a/fontaine.el
+++ b/fontaine.el
@@ -99,6 +99,14 @@
:line-number-weight nil ; falls back to :default-weight
:line-number-height 1.0
+ :tab-bar-family nil ; falls back to :default-family
+ :tab-bar-weight nil ; falls back to :default-weight
+ :tab-bar-height 1.0
+
+ :tab-line-family nil ; falls back to :default-family
+ :tab-line-weight nil ; falls back to :default-weight
+ :tab-line-height 1.0
+
:bold-family nil ; use whatever the underlying face has
:bold-weight bold
:italic-family nil
@@ -169,6 +177,14 @@ The properties in detail:
all fall back to the respective default values, as described
above.
+- The `:tab-bar-family', `:tab-bar-weight', and `:tab-bar-height'
+ apply to the `tab-bar' face. They all fall back to the
+ respective default values, as described above.
+
+- The `:tab-line-family', `:tab-line-weight', and
+ `:tab-line-height' apply to the `tab-line' face. They all fall
+ back to the respective default values, as described above.
+
- The `:bold-family' and `:italic-family' are the font families
of the `bold' and `italic' faces, respectively. Only set them
if you want to override that of the underlying face.
@@ -257,6 +273,14 @@ Caveats or further notes:
((const :tag "Line number regular weight"
:line-number-weight) ,fontaine--weights-widget)
((const :tag "Line number height" :line-number-height) float)
+ ((const :tag "Tab bar font family" :tab-bar-family) string)
+ ((const :tag "Tab bar regular weight" :tab-bar-weight)
,fontaine--weights-widget)
+ ((const :tag "Tab bar height" :tab-bar-height) float)
+
+ ((const :tag "Tab line font family" :tab-line-family) string)
+ ((const :tag "Tab line regular weight" :tab-line-weight)
,fontaine--weights-widget)
+ ((const :tag "Tab line height" :tab-line-height) float)
+
((const :tag "Font family of the `bold' face" :bold-family)
string)
((const :tag "Weight for the `bold' face" :bold-weight)
,fontaine--weights-widget)
@@ -506,6 +530,26 @@ ARGS are its routines."
(or (plist-get properties :line-number-height) 1.0)
frame))
+(fontaine--apply-preset
+ fontaine--apply-tab-bar-preset
+ "Set `tab-bar' face attributes based on PRESET for optional FRAME."
+ (fontaine--set-face-attributes
+ 'tab-bar
+ (or (plist-get properties :tab-bar-family) (plist-get properties
:default-family))
+ (or (plist-get properties :tab-bar-weight) (plist-get properties
:default-weight))
+ (or (plist-get properties :tab-bar-height) 1.0)
+ frame))
+
+(fontaine--apply-preset
+ fontaine--apply-tab-line-preset
+ "Set `tab-line' face attributes based on PRESET for optional FRAME."
+ (fontaine--set-face-attributes
+ 'tab-line
+ (or (plist-get properties :tab-line-family) (plist-get properties
:default-family))
+ (or (plist-get properties :tab-line-weight) (plist-get properties
:default-weight))
+ (or (plist-get properties :tab-line-height) 1.0)
+ frame))
+
(fontaine--apply-preset
fontaine--apply-bold-preset
"Set `bold' face attributes based on PRESET for optional FRAME."
@@ -589,6 +633,8 @@ Call `fontaine-set-preset-hook' as a final step."
(fontaine--apply-mode-line-inactive-preset preset frame)
(fontaine--apply-header-line-preset preset frame)
(fontaine--apply-line-number-preset preset frame)
+ (fontaine--apply-tab-bar-preset preset frame)
+ (fontaine--apply-tab-line-preset preset frame)
(fontaine--apply-bold-preset preset frame)
(fontaine--apply-italic-preset preset frame)
(setq fontaine-current-preset preset)