2

enter image description here enter image description here I'm unable to adjust the font size for the font family Font Awesome 5 Pro. It appears that any buffer prints the FA characters 95pt high by default. I'd like to change that too, but it also seems that I'm unable to adjust the font-size if set directly using a font face.

I've tried defining my own font face (called org-bullets-face) to apply to org-bullets-face-name, but it doesn't seem to be working. Also note that the color of the rendered font changes along with the set 'org-bullets-face properties.

describe-font command output:

  name (opened by): -PfEd-Font Awesome 5 Pro-normal-normal-normal-*-95-*-*-*-*-0-iso10646-1
       full name: Font Awesome 5 Pro:pixelsize=95:foundry=PfEd:weight=normal:slant=normal:width=normal:scalable=true
       file name: /usr/share/fonts/TTF/fa-light-300.ttf
            size: 95
          height: 96
 baseline-offset:  0
relative-compose:  0
  default-ascent:  0
          ascent: 84
         descent: 12
   average-width:  1
     space-width: 95
       max-width:  0

describe-char command output:

             position: 4776 of 11279 (42%), column: 10
            character:  (displayed as ) (codepoint 61713, #o170421, #xf111)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0xF111
               syntax: w    which means: word
             category: L:Left-to-right (strong)
             to input: type "C-x 8 RET f111"
          buffer code: #xEF #x84 #x91
            file code: #xEF #x84 #x91 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-PfEd-Font Awesome 5 Pro-normal-normal-normal-*-95-*-*-*-*-0-iso10646-1 (#xA0)

Character code properties: customize what to show
  general-category: Co (Other, Private Use)
  canonical-combining-class: 0 (Spacing, split, enclosing, reordrant, and Tibetan subjoined)
  bidi-class: L (Left-to-Right)
  decomposition: (61713) ('')
  mirrored: N

There are text properties here:
  face                 org-code
  fontified            t

Note that the font does render in Emacs (Font Awesome utilizes unused UTF-8 space for custom glyphs).

And finally, here's a relevant code snippet of what I've written.

#+begin_src emacs-lisp :results silent :exports code
  (use-package org-bullets
    :ensure t
    :init
    (defface org-bullets-face
      '((((class color) (background light))
     (:foreground "midnight blue" :weight bold))
    (((class color) (background dark))
     (:foreground "grey" :weight bold))
    (t (
        :foundry "PfEd"
        :family "Font Awesome 5 Pro"
        :weight normal
        :width normal
        :slant normal
        :height 1.5
        ))) 
      "face font for org-bullets" 
      :group 'org-faces)

    (setq org-bullets-face-name (quote org-bullets-face))
    (setq org-bullets-bullet-list 
      (quote ("\uf054" "\uf105" "\uf067" "\uf069")))
    (setq org-ellipsis "...")
    :config
    (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+end_src

I've also tried using set-face-font a couple ways

(set-face-font 'org-bullets-face 
  "-PfEd-Font Awesome 5 Pro-normal-normal-normal-*-95-*-*-*-*-0-iso10646-1")

I noticed that when using the customize menu that characters render when omitting the foundry part when specifying font-family and instead include it in the :foundry tag.

(set-face-font 'org-bullets-face 
      "-Font Awesome 5 Pro-normal-normal-normal-*-95-*-*-*-*-0-iso10646-1")

and I also tried

(set-face-font 'org-bullets-face "Font Awesome 5 Pro")

So how do I define a font family's default global properties as well as specify properties for org-bullets? Also, how do I specify the "Light", "Regular" and "Solid" font types? When I try to specify "solid" in the customize menu, it reports that it's an invalid option.

EDIT

Evaluating (set-face-attribute 'org-bullets-face nil :font "Font Awesome 5 Pro-1200:style=Solid") does produce HUGE characters, but I can't recognize any change in font height as I decrease it below 70-79. Why is the font not scaling properly?

Edit 2:

I've made some sort of "progress", but I'm still stumped about handling unicode ttf. In case it does help someone I installed the otf font files, of which is appears Emacs 'randomly' defaults to. The font size was acceptable, however it uses the Solid face instead of Regular or Light. I was able to patch that up this way:

(set-face-font 'org-bullets-face "Font Awesome 5 Pro Regular")
(set-face-attribute 'org-bullets-face nil
  :family "Font Awesome 5 Pro Regular"
  :foundry "PfEd")

I'm not marking this as solved because the problem hasn't really been resolved. TTF support is included in Emacs and each relevant glyph does render; however, manipulating the TTF fonts doesn't appear to work very well.

What is more, it appears that Emacs actually uses more than one font at a time such that it can render glyphs not supported by the current active font. The font it chooses in such cases, it seems, is random. I haven't found a way readily available way to remap Unicode values to a particular 'fallback' font or set its properties. Will appending another fallback font help in this regard? I've checked my current fallback list and Font Awesome doesn't appear, yet Emacs is able to find and use it anyway. I've been digging through documentation and code, but this is turning into one rabbit hole after another.

Please help me correct any erroneous statements I've made above. I also appreciate any help to continue to shed some light on how Emacs handles Unicode, TTF, and events in which the current font doesn't support a particular Unicode value.

  • The font specification in your set-face-font call explicitly sets the pixel size to 95. That might be the source of the problem. – Tyler Jan 31 '18 at 17:48
  • I've only tried set-face-font after the fact. At any rate, (set-face-font 'org-bullets-face "-PfEd-Font Awesome 5 Pro-normal-normal-normal--95----*-0-iso10646-1") doesn't produce any output and no change occurs if I change '95' to, for example, 5. And note that the second picture I posted has Font Awesome glyphs printed that are not governed by org-bullets what-so-ever. – Derrekito Jan 31 '18 at 18:25
  • I had the same issue. Removing the ttf font to only keep the otf solved it. – skizo Nov 22 '18 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.