1

I have been trying to configure emacs to use JetBrains Mono font, unfortunately i can hardly understand the way emacs handles font settings, there are way too many options and stuffs going on. So i got lost and here is my current font settings -

(set-face-attribute 'default nil
                    :family "JetBrains Mono"
                    :height 110
                    :weight 'light)
(set-face-attribute 'variable-pitch nil
                    :family "JetBrains Mono"
                    :height 1.0)
(set-face-attribute 'fixed-pitch nil
                    :family "JetBrains Mono"
                    :height 1.0)

But this seems not as per recommended settings from the jetbrains's site -

Size: 13
Line spacing: 1.2

I don't know to relate :height with Size: 13, couldn't figure that out. I also failed to match the line spacing 1.2. If i use (setq line-spacing 1.2) emacs renders lines way too separated vertically.

I am using emacs 27.1 with harfbuzz.

So if anyone has been using this font with emacs, please share your configuration or point me to some place where i can get/understand how to configure and match the recommended settings.

Thanks in advance.

1

Here is a snippet from my custom.el:

 '(default-frame-alist
    '((fullscreen . fullscreen)
      (font . "JetBrains Mono-13")
      (line-spacing . 0.2)))

The JetBrains website doesn't specify the unit for their recommendation of "13", but inspecting the CSS reveals that their examples have a CSS font-size of 13px.

Emacs documentation on fonts specifies that the sizes point sizes.[1]

Emacs on my macOS machine reports the value of display-pixels-per-inch as "72" whereas CSS specifies that a pixel is 1/96th of 1 inch.[2] Nevertheless, the value of 13 points in Emacs seems to be the same height in real display pixels as the 13 pixels on the JetBrains website in Chrome and Firefox and I can't understand why that would be.

The line-spacing property is set as a height spec and refers to the amount of space added below each line. Therefore, you only want the extra space more than a default, single line height. The value should be 0.2.

Your Answer

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

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