Reputation: 80
I would like to know how to get similar font rendering in GNU Emacs as in GVim as shown in the screenshot below. It seems Emacs has an inferior way of rendering fonts by default. I've tried installing the Infinality font patches but I got the same results. I am running GNU Emacs 24.3 on my Arch Linux virtual machine. I have no Desktop Environment and am using OpenBox as my window manager.
A lot of forum posts I dug up seemed to hint at the libxft library that Emacs uses needing patching in the past, but not anymore. According to Emacs it has been compiled --with-xft
so that shouldn't be an issue. Below is a screenshot from both applications and a zoomed in view to highlight the difference in rendering.
Upvotes: 4
Views: 4763
Reputation:
In my experience, Emacs does not reliably read font settings from font config or from Gnome, so you may need to change Emacs' font rendering settings.
Notably, the colored pixels around the font in GVim indicate that GVim uses subpixel rendering, whereas the absence of these pixels in Emacs shows that it only uses hinting. The absence of subpixel rendering often makes fonts look blurry.
Find out what font rendering settings GVim uses. I presume it takes the standard ones from Gnome, so install Gnome Tweaktool to inspect the font settings from Gnome.
Now create an .Xresources
file that tells Emacs about these settings. The following is represents my font settings, adapt it according to what you have found out in Gnome Tweaktool:
Xft.antialias: 1
Xft.hinting: 1
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
As far as I know, the lcdfilter
setting isn't available in Gnome Tweaktool, so just leave it on lcddefault
. After creating the file
C-x C-c
Load these settings with:
$ xrdb -merge ~/.Xresources
Verify that the settings were loaded:
$ xrdb -query | grep Xft
Xft.antialias: 1
Xft.hinting: 1
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
Restart Emacs
Now check whether the fonts look the same now. Note that GVim may use a different font renderer (e.g. Cairo, Harfbuzz or whatever), so expect some slight differences anyway.
xrdb -query
command to verify the presence of your font settingsUpvotes: 9