Here's a minimal example that does something on Linux (Ubuntu 16.04) that doesn't seem right to me:

M-: (set-frame-font "Ubuntu") M-x describe-font <RET>

The first couple of lines that Emacs 25.1 (-Q) reports are:

name (opened by): -DAMA-Ubuntu-normal-normal-normal-*-16-*-*-*-*-0-iso10646-1
  full name: Ubuntu:pixelsize=16:foundry=DAMA:weight=normal:slant=normal:width=normal:scalable=true
  file name: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-M.ttf

It's the bottom line of this that's wrong (Ubuntu-M.ttf) - Emacs is selecting the "Medium" font weight variant, instead of the "Regular". Like many fonts, the Ubuntu font has weight variants beyond the well-known "Regular" and "Bold". Such additional weights can include "Light", "Book", "Demi-Bold", "Black", "Medium".

I would like to use the Ubuntu Regular font for variable-pitch-mode, but the Medium weight isn't suitable. I've tried various different Emacs ways of specifying a font, including "Ubuntu", "Ubuntu-11:weight=Regular", "-DAMA-Ubuntu-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1".

All of these display text in emacs in the wrong, medium weight. Some apps allow selecting font weight by numbers (e.g. 200=Bold), but not, I believe, Emacs. Still, the system's font selection appears to be correct, and I don't understand why Emacs isn't using this

alex@Lucifer:~$ fc-match "Ubuntu"
Ubuntu-R.ttf: "Ubuntu" "Regular"
alex@Lucifer:~$ fc-list "Ubuntu" file family style weight
[correct output]

Can anyone confirm that this problem exists on Linux (it works fine on my Windows machine)? And, even better, can anyone point me to how to get Emacs to pick the correct weight of font?

  • 1
    Have you tried to set it like this "Ubuntu-11:weight=book"? That helped me with Roboto Mono.
    – catemperor
    May 19, 2017 at 19:20
  • From the code in Emacs' font.c that looks more promising. It looks like Emacs turns the weight names into a number, but treats "regular", "medium" etc. all as 100, which is nearest the Ubuntu font's "medium" weight. "book" should be 75, but sadly this still ends up rendering in Medium. May 22, 2017 at 16:46
  • And I found out that even adjusting the font size with text-scale-adjust will break my workaround. Hope someone more knowledgeable than me can answer this question.
    – catemperor
    May 22, 2017 at 19:20
  • For some fonts (and, sadly, for others not) it is possible to denote the internal font file name; eg. to use SourceCodePro-regular.ttf I can use :font "xft:SourceCodePro Regular:size=8". Maybe this works for your font, too.
    – user17303
    Oct 24, 2017 at 0:25

1 Answer 1


Not being able to distinguish between "medium" and "regular" weights of fonts on Linux was reported as a bug on Emacs (not by me, although the discussion references this issue). On 21.10.2021 a fix was committed to Emacs git tree (again, not by me, open source ♥).

So the solutions are:

  1. Use the latest release of Emacs (version >= 28), or
  2. Hide the "medium" weight of the font, either by not installing it or renaming the file extension. This means, of course, that the medium weight will not be available to any application.

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.