emacs23 buffer menu font (GTK) - emacs

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.

Related

How to increase font size/font family of NetBeans IDE? (not the text editor's font)

I'm having a problem with NetBeans fonts on my computer which for some reason are getting distorted. I decided to open this question because all searches I made ended up on how to change the fonts of the text editor but not of the IDE itself. As you can see on this printscreen, it is kinda hard to read because of this missing parts of the characters. I was having exactly the same problem with burp suite then I increase the font-size (didn't found a option there to change font-family) and it solved a little bit. I think that if I change these configurations it will be easier for me to read. Thanks in advance.
The solution came from http://wiki.netbeans.org/FaqFontSize
There's 2 options to do:
Run netbeans with the additional --fontsize X parameter from the commandline
Edit the netbeans.conf file located in the %NETBEANS_INSTALLATION_DIRECTORY\etc directory and at the part that says netbeans_default_options=.... append --fontsize X (Be sure that the option -J-Dsun.java2d.dpiaware is set to true. Netbeans will ignore the --fontsize instruction if is false).
This should change the default GTK font size. As noted in the link, it may not work in Gnome desktop environments because the font there is controlled by Gnome.
The netbeans.conf file for 10.x seems to have a slightly different syntax than previous versions.
In 8.2, adding "--fontsize x" worked. I couldn't get it to work in 10.0.
But adding "--fontsize x" to the start cmd works fine and doesn't compromise the font crispness when using a HD screen.

Emacs24 not rendering fonts properly

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

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 24 Ubuntu Menu Panel

just installed Emacs 24 on a ubuntu precise OS. The menu bar in the top panel is missing a number of options (e.g. using Auctex, all the Latex options).
I recall seeing on the web somewhere that it was possible to have the menu on top of the Emacs frame rather than the unity default of the top panel. There is an answer on SO for how to enable the global menubar in ubuntu. Can someone please point me to how to disable it in the global menu until it gets to the point where they play well together.
Thanks
Ubuntu has a hardcoded hack to disable the global menubar for applications matching certain filename patterns. emacs is among those, as is firefox, another popular program that suffers from the same sorts of problems of GTK detached menubars not updating in the usual way that X programs expect them to.
Try running update-alternatives to select emacs24 as your default Emacs, then use emacs to start it, rather than emacs24.
I was using the symlink method mentioned by #Bernhard Kausler, but found I couldn't pin the icon that resulted from staring emacs from the shell in this way without it reverting to using the global menu.
I got a working unity launcher shortcut with this .desktop file:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_NZ]=emacs
Name[en_NZ]=Gnu Emacs 24
Exec=emacs
Name=Gnu Emacs 24
Icon=emacs
StartupWMClass=Emacs24
Now I can have emacs pinned to the launcher and it launches with its own menu bar.
You can just create a symbolic link to the emacs??? command you use to launch emacs, and if the symbolic link's name is exactly 'emacs', it will not use the global menu when launched.
This is a known bug with Emacs dynamic menus where changing major modes adds or removes entries from the menu.
https://bugs.launchpad.net/ubuntu/+source/appmenu-gtk/+bug/673302
It's unfortunate that the names of the blacklisted apps are hard coded into the appmenu-gtk package, and that there does not seem to be a way to add items without touching the source code.

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.