protesilaos / fontaine

Set Emacs font configurations using presets
https://protesilaos.com/emacs/fontaine
GNU General Public License v3.0
55 stars 1 forks source link

Support `tab-bar` and `tab-bar-tab*` faces separately #7

Open alphapapa opened 3 months ago

alphapapa commented 3 months ago

Hi again Prot,

As I mentioned in #6, the new support for the tab-bar face is helpful, but it precludes the user from applying a different face to tab-bar-tab* faces (e.g. to have tabs themselves in one font and other, non-tab text in the tab bar in another).

Could the tab-bar and tab-bar-tab* faces be handled separately in the next version of Fontaine? i.e. I'd suggest that tab-bar-tab inherit from tab-bar by default, and that tab-bar-tab* faces inherit from tab-bar-tab, but that they be specified in a way so that tab-bar could be set to a different font than tab-bar-tab if desired.

Thanks for your work on Fontaine.

protesilaos commented 3 months ago

Hello Adam!

Yes, sure! Can you list all the faces you are interested in? We will take it from there.

I guess this extends to the tab-line as well?

alphapapa commented 3 months ago

I don't know if I have a list of faces per se. But if it helps, here's the code I currently use to customize these faces when changing theme:

(progn
  ;; NOTE: If Fontaine gains support for the :width attribute, this
  ;; code would likely be unnecessary. See
  ;; <https://github.com/protesilaos/fontaine/issues/6> and
  ;; <https://github.com/protesilaos/fontaine/issues/7>.
  (defun ap/modify-faces (&rest faces)
    (pcase-dolist (`(,face . ,spec) faces)
      (map-do (lambda (attribute value)
                (set-face-attribute face nil attribute value))
              spec)))

  (defun ap/modify-tab-bar-faces (&rest _)
    (ap/modify-faces
     '(tab-bar :family nil :inherit (variable-pitch))
     '(tab-bar-tab :family "NK57 Monospace" :width condensed :weight bold
                   :inherit (tab-bar))
     '(tab-bar-tab-inactive :inherit (tab-bar-tab))))

  (defun ap/modify-tab-line-faces (&rest _)
    (ap/modify-faces
     '(tab-line-tab-special :slant italic)))

  ;; The tab-bar tabs should be "NK57 Monospace" condensed, but
  ;; the rest of the tab-bar line should be variable-pitch to
  ;; save space.
  (add-hook 'enable-theme-functions #'ap/modify-tab-bar-faces)
  (add-hook 'enable-theme-functions #'ap/modify-tab-line-faces)
  (ap/modify-tab-bar-faces)
  (ap/modify-tab-line-faces))

Please let me know if you have any other thoughts or questions.

protesilaos commented 3 months ago

Okay, I will look into this. I am not using either of those bars so I have to test that we do not get into some awkward scenario by using different fonts.