2

I use spacemacs theme on Emacs 28.2.

My config for faces is:

  (custom-theme-set-faces                                          
   'user                                                           
   '(variable-pitch ((t (:family "ETbb" :height 180))))            
   '(fixed-pitch ((t ( :family "Fira Code Retina" :height 160))))
   (set-face-attribute 'org-table nil  :inherit 'fixed-pitch)
   ) 
  (add-hook 'org-mode-hook 'variable-pitch-mode)

And

  (custom-theme-set-faces                                                       
    'user                                                                       
    '(org-block ((t (:inherit fixed-pitch))))                                   
    '(org-code ((t (:family "DejaVu Sans Mono"))))
    '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))          
    '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))      
    '(org-property-value ((t (:inherit fixed-pitch))) t)                        
    '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
    '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
    '(org-table ((t (:family "DejaVu Sans Mono" :foreground "#83a598"))))
    '(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
                   

In order to set headings and TODO fonts I added this to the last code block:

'(org-todo ((t (:font "DejaVu Sans Mono"))))
'(org-level-1 ((t (:font "Gillius ADF"))))

The result is that

  • org-level-1 has Gillius ADF but size doesn't change when doing text-scale-increase/text-scale-decrease.
  • org-todo has ETbb font instead of DejaVu Sans Mono

Hence my question: how to set the heading and TODO fonts?

EDIT (additional information):

  • describe-face > org-todo gives:
Face: org-todo (sample) (customize this face)

Documentation:
Face for TODO keywords.

Defined in ‘org-faces.el’.


           Family: DejaVu Sans Mono
          Foundry: PfEd
            Width: normal
           Height: 113
           Weight: normal
            Slant: normal
       Foreground: #dc752f
DistantForeground: unspecified
       Background: #f6f1e1
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: #<font-object -PfEd-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1>
          Fontset: unspecified
           Extend: unspecified
          Inherit: bold
  • C-u C-x = on TODO gives:
             position: 5 of 21475 (0%), column: 4
            character: X (displayed as X) (codepoint 88, #o130, #x58)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x58
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Strong L2R, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 58" or "C-x 8 RET LATIN CAPITAL LETTER X"
          buffer code: #x58
            file code: #x58 (encoded by coding system utf-8-unix)
              display: by this font (glyph code):
    ftcrhb:-PfEd-ETbb-bold-normal-normal-*-24-*-*-*-*-0-iso10646-1 (#x39)

Character code properties: customize what to show
  name: LATIN CAPITAL LETTER X
  general-category: Lu (Letter, Uppercase)
  decomposition: (88) ('X')

There are text properties here:
  face                 (:foreground "#af00ec" :background "FF" :bold t :weight bold)
  fontified            t
  • describe-face > org-level-1 gives
Documentation:
Face used for level 1 headlines.

Defined in ‘org-faces.el’.


           Family: Gillius ADF
          Foundry: ADFP
            Width: normal
           Height: 113
           Weight: bold
            Slant: normal
       Foreground: #3a81c3
DistantForeground: unspecified
       Background: unspecified
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: #<font-object -ADFP-Gillius ADF-bold-normal-normal-*-15-*-*-*-*-0-iso10646-1>
          Fontset: unspecified
           Extend: nil
          Inherit: bold
  • C-u C-x = on Level 1 Headline gives:
               position: 20579 of 21475 (96%), column: 9
            character: i (displayed as i) (codepoint 105, #o151, #x69)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x69
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Strong L2R, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 69" or "C-x 8 RET LATIN SMALL LETTER I"
          buffer code: #x69
            file code: #x69 (encoded by coding system utf-8-unix)
              display: by this font (glyph code):
    ftcrhb:-ADFP-Gillius ADF-bold-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x4A)

Character code properties: customize what to show
  name: LATIN SMALL LETTER I
  general-category: Ll (Letter, Lowercase)
  decomposition: (105) ('i')

There are text properties here:
  face                 org-level-1
  fontified            t
4
  • Use describe-face to figure out how each face is defined and what it inherits from. Use C-u C-x = on a character in the buffer to find out its face. It will take some fumbling to figure out what's going on.
    – NickD
    Sep 19, 2022 at 11:58
  • I edited the question to add the command you mentioned. I noticed another issue (maybe I should open a new question): Everything that is not variable-pitch is not affected by text-scale-increase/text-scale-decrease.
    – crocefisso
    Sep 19, 2022 at 13:15
  • Yes, you probably should add a new question if that is the case.
    – NickD
    Sep 19, 2022 at 13:51
  • I managed to solve this issue by changing fixed-pitch value from 160 to 0.8 (found the solution here). It didn't solve the heading and TODO issue though...
    – crocefisso
    Sep 19, 2022 at 16:18

1 Answer 1

1
  1. Instead of :font, use :family

  2. Instead of using custom-theme-set-faces to set TODO font, use org-todo-keyword-faces.

    Example:

    (setq org-todo-keyword-faces '(
                     ("BACKLOG" . (:family "DejaVu Sans Mono" :foreground "#ae81ff" :background "FF" :bold t :weight bold))
                     ("NEXT" . (:family "DejaVu Sans Mono" :foreground "#af00ec" :background "FF" :bold t :weight bold))
                     ("MEETING" . (:family "DejaVu Sans Mono" :foreground "#00ffc0" :background "FF" :bold t :weight bold)) 
                     ("STARTED" . (:family "DejaVu Sans Mono" :foreground "#ff84c9" :background "FF" :bold t :weight bold))
                     ("WAITING" . (:family "DejaVu Sans Mono" :foreground "#fbd814" :background "FF" :bold t :weight bold))
                     ("DELEGATED" . (:family "DejaVu Sans Mono" :foreground "#fc5155" :background "FF" :bold t :weight bold))
                     ("DONE" . (:family "DejaVu Sans Mono" :foreground "gray65" :background "FF" :bold t :weight bold))
                     ("DEFERRED" . ( :family "DejaVu Sans Mono":foreground "#4577d7" :background "FF" :bold t :weight bold))
                     ("CANCELLED" . (:family "DejaVu Sans Mono" :foreground "gray40" :background "FF" :bold t :weight bold))
                     )
    )
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.