Tested on: CentOS release 5.6 (Final)
The newer version of emacs (23.x) has a nice option in menu to change the default font. But the older emacs (21.4.1) does not have these options. The older (& stable) versions of emacs are generally shipped with centos. Here are steps for changing the default fonts in emacs 21.4.1
Option 1 (for current sessions only)
Option 2 (for all future sessions) We have to find the available system fonts and apply them to ~/.emacs file.
Option 1 (for current sessions only)
- Open emacs.
- Left-click on mouse while holding 'Shift' key on keyboard. A Font-menu will pop-up.
- Play around with the menu & set required font.
Option 2 (for all future sessions) We have to find the available system fonts and apply them to ~/.emacs file.
- Open terminal & execute following command:
xfontsel
- Left-click on 'fmly' & others to select a value. You will be able to see how the font looks like in the same window. When you are satisfied with the font selected press 'Select' button. It will copy the font name with details to clipboard. Following are some of the examples of the fonts:
-*-courier-medium-r-*-*-17-*-*-*-*-*-iso8859-*
-*-lucidatypewriter-medium-*-*-*-14-*-*-*-*-90-iso8859-*
-*-luxi mono-medium-r-*-*-17-*-*-*-*-*-ascii-*
- Open ~/.emacs file in any text editor and add following at the end of the file:
(set-default-font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*")
Replace -*-*-*-*-*-*-*-*-*-*-*-*-*-* by your selected font name (like one of the examples shown above) Save ~/.emacs & re-launch emacs. You should be able to see the difference. - There might be some delay before text is displayed in emacs. Add following to top of the ~/.emacs file for a workaround:
(modify-frame-parameters nil '((wait-for-wm . nil)))