Emacs24 not rendering fonts properly - emacs

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.

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 GVims preferences
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.
Tell Emacs about your font preferences
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
Exit Emacs with 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.
Check that the settings are permanent
Log out of your desktop
Log in again
Use above xrdb -query command to verify the presence of your font settings

Related

What are the "font settings theme" packages available in emacs

Is there any emacs package for font settings similar to color-theme for color. I am looking for a package which already has some good font settings and can be selected without restart of emacs
(I agree with #lawlist that superuser.com might be a better site for this question.)
Here are two answers such packages:
Icicles, with command icicle-font.
Do Re Mi, with command doremi-font+ (also commands doremi-font-size+, doremi-frame-font-size+, and doremi-buffer-font-size+, which affect only the font size).
All of these commands let you choose a font interactively, seeing the effect immediately. You can cycle among some or all of the available fonts. With icicle-font you can type parts of the font name, to narrow the font choices, then cycle among that subset etc.
These are the quickest and friendliest ways I know of to choose a font -- either once and for all (e.g. customize Emacs so it uses that font by default) or to change on the fly.

Emacs on Windows 7: How to get color theme »solarized-light« working?

I'm using Emacs 24 on Windows 7. I installed the solarized theme, see here: https://github.com/sellout/emacs-color-theme-solarized
It is easy to switch to the color-theme, e.g. by doing M-x load-theme and then pick solarized-light.
But especially the colors of solarized-light are nearly unreadable. The colors are not even close to the colors of the pictures. I guess there is something wrong with a thing called »color palette«, see here: console2 colors solarized
Any ideas?
Edit: I made a screenshot of Emacs which shows the pretty low contrast.
So, I installed it now, and I see the lack of contrast. But the difference seems to be cause by the difference in font rendering across operating systems.
The screenshots on the github page have most likely been done on Mac OS, which renders the fonts the thickest. The theme looks reasonable on Linux with the default font, although, depending on the settings, it renders the text a bit or more thinner. And Windows renders text with the smallest amount of "ink", so to speak. While it's considered sharper my some users, it also makes things worse when a theme uses low-contrast colors, such as the light version of Solarized.
Another thing to note is that the screenshots are done in Vim, which has a different syntax highlighting mechanism from Emacs, so the colors on keywords, etc, are bound to be different.
But I took two screenshots, on Ubuntu and Windows, opened them in Gimp, zoomed in, used the color picker, and the value of the blue color was approximately the same as on the reference screenshot: 2690db.
In my view, i don't feel the theme work improperly.
The following is my screenshot, os x, Emacs 24.3
Have you tried to change another font or theme (if that is not your only love)

Text Zoom in putty emacs

I'm currently using Emacs 23.1 on a remote server through putty. I would like to be able to zoom out (so I can view all my code when needed). I've tried several methods and none of them have worked.
Text-scale-decrease and text-scale-increase give no errors but don't change the text size
The zoom-frm plugin tells me that "symbol's function definition is void: query-fontset" when I attempt to use any of its methods (all dependencies listed are installed)
The doremi-frm plugin either gives no errors and does nothing, or complains about face-remap (depending on what function is used)
I'm wondering at this point if zoom is possible within putty, and if so how do I get it to work properly.
P.S. Opening a remote X11 session with the Emacs GUI is not an option.
Thanks.
You need to config putty instead.
Open putty, then right click > Change Settings > Window > Fonts on the left panel to change font size.
What Emacs are you using? You say Emacs 23.1, but that has `query-fontset' (as do also older and more recent Emacs versions, from GNU Emacs 20 to the latest GNU Emacs 24 dev build).
Likewise, GNU Emacs 23.1 has face-remap' and all of its relatives,face-remap-*'.
I can't answer the putty questions, but can you check in some other way whether Emacs at the remote end actually zooms OK using any of the methods you describe? IOW, try to remove putty from the equation, to see what happens.

emacs23 buffer menu font (GTK)

I've recently upgraded to emacs23 (Ubuntu 10.04) and I've managed to get my faces (fonts) all sorted out with relevant .emacs options.
However the one font I can't seem to change is the one used to display the Buffer Menu (i.e. when you CTRL+left-click on a buffer, you get a pop-up menu that lists all open buffers).
The problem is that the font used to display this menu is proportional (not fixed-width) and it makes a big mess of the menu - nothing is lined up vertically, and I often use this to see which buffers hold files that are in common directories. The proportional font has the paths all over the place.
I believe Ubuntu's emacs23 was built with GTK rather than Lucid. Some things I've read seem to indicate that there's no way to set this font within Emacs - that is has to be done externally using GTK config - if this is true, how?
Otherwise, if it can't be done, how tricky is it to recompile emacs23 with Lucid rather than GTK support on Ubuntu? Can it be done easily with "apt-get source"?
I believe I have discovered the answer:
http://www.gnu.org/software/emacs/manual/html_node/emacs/GTK-resources.html
The idea is to create ~/.emacs.d/gtkrc and use the GTK config mechanism to set up alternative styles for emacs' GTK widgets.
$ cat ~/.emacs.d/gtkrc
style "menufont"
{
font_name = "monospace 10" # Pango font name
}
widget "*emacs-menuitem*" style "menufont"
Seems to work well.

How do I get my Emacs to *always* use 6x13 on X11

I recently declared .emacs bankrupcy and reorganized my init stuff. In
the process, I ripped out all the hacky font selection stuff I had
accrued over the years, figuring there are probably easier ways to
accomplish what I want in the most modern version of emacs.
GNU Emacs 23.0.91.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4)
on a GNU/Linux System (Ubuntu 8.10).
Let's
ignore, for the moment, the fact that I also run emacs under Mac OS X
(GUI+Terminal) and occasionally on Windows and just focus on the X11
case:
(Background: The font 6x13 has been part of X11 for as long as I can remember. (a.k.a
misc-fixed semi-condensed ...). It's a bitmap font.)
I want emacs to always use the X11 bitmap font 6x13. (This gives me two buffers next to eachother on my netbook.)
I don't want to see DejaVu Sans Mono 16pt or whatever the heck comes up by default on my netbook (it's huge!)
I want every new frame and window to use this font.
I want derived faces (like org-mode-column) to use 6x13 font and not mysteriously switch back to DejaVu Sans Mono
I don't care what GNOME and X11 think the logical DPI of my screen is. I want 6x13.
When I remote into my netbook (NX Machine) I don't want to see 6x10. I want 6x13.
In case there's any doubt: I want 6x13.
What's the canonical way to do to make this happen?
And before some smart-aleck tells me about menu: Options>>Set Default
Font: the resulting dialog box doesn't even offer bitmap fonts, so
there's no way to choose 6x13. Furthermore, it doesn't solve the
problem with org-mode: table-views still come up with the wrong font.
I control this stuff from my .Xresources file.
Personally I have
emacs.reverseVideo: true
emacs.font: 7x13bold
(And I quite agree... long live the bitmap fonts! I'll take my xterm with
XTerm*foreground: green
XTerm*background: black
XTerm*font: 7x13bold
...
over the Gnome terminal any day).
If you're playing with .Xresources from within a session, xrdb command is useful to reload them.
You want to set the default frame parameters in your .emacs.
find out the name of the font you want to use
add the needed value to the default-frame-alist.
The easiest way, actually, is to use customize and customize default-frame-alist, but can also use elisp and write
(setq default-frame-alist
'(font . "-*-*-medium-r-normal--16-*-*-*-*-*-fontset-hiramin_w6"))
That's stolen from my emacs, you'll need to find the full font name (xfontsel?) for the font you want.
See also the EmacsWiki on setting fonts and faces.
For anyone reading this with a recent Linux distribution you will have to install 6x13 first (yes, sounds obvious..). There are instructions here for Ubuntu/Debian which should work on other distros too if you skip the apt-getting of random fonts. Install the "FixedSC" .tgz from there (it unpacks to /usr/local/share/fonts) then follow the instructions to add it to the font cache so it will appear in the Gnome Font selection dialog.