| by Arround The Web | No comments

Increase Font Size in Emacs on Linux

As an Emacs user, the default font size on the current buffer or the global buffers may not suit your case. You may feel that the current size is too large or small for clear visibility. When working with texts, knowing how to adjust the font size frees you from straining your eyes by giving you the power to change the text size for the best visibility. There are different ways to increase the font size in Emacs on Linux, and this post will go through a few of the best options that you should use.

Two Ways of Increasing the Font Size in Emacs on Linux

Some people are okay with the default font size in Emacs, but suppose the font size is too small for you. There are quick steps to increase the font size to a comfortable size. Go through each discussed method to see which works best for you.

Method 1: Using the Key Combinations

Using the key shortcuts to achieve different tasks in Emacs is not new. Even when it comes to adjusting the font size, there are key combinations that you can use to increase the font size in Emacs.

We use the following buffer that contains three lines of text:

To increase the font size, press “C-x c-+”. The shortcuts mean that you press the “Ctrl” key, then x, release the x, and press “+” to increase the font size gradually until you get a comfortable font size that gives you the best visibility.

Using this key combination only affects the current buffer, and the changes in the font size are temporary for the buffer. The following is an example on how we increase the font size for our buffer:

After increasing the font size, you may also want to decrease it as a way of having control over the text size. We use the same key combination for that, but instead of pressing “+”, we press “-” until we obtain the desired font size. Use the “C-x C–” keys. Notice how, as you keep pressing the “C–“, the font size keeps reducing even below the default font size.

To return to the default font size, press the “C-x C-0”. The buffer will use the default font size, the global font size for your Emacs.

Method 2: Adjusting for the Current Buffer with Command

Emacs offers the “text-scale-adjust” command that you can use to increase the font size for the current buffer interactively. To use this option, open your Emacs on any buffer where you want to increase the font size. Next, press the “M-x”, the “Alt + x” keyboard key, and then type “text-scale-adjust”.

Once you press the RET/Enter key, you will get an output that shows how to adjust the text size. You can use “+ to increase, “ to decrease, or 0 to restore the font size.

For our case, we want to increase the font size. In that case, press the “Ctrl” and “+” keys together and keep pressing the “+” key to increase the font size interactively. While pressing the “+” key, ensure that you are still holding the “Ctrl” key.

If you want to decrease the font size, add the same “text-scale-adjust” command and press “Ctrl” and “–” to decrease the font size. Keep pressing the “–” until you have your preferred font size.

You can also quickly restore the font size by pressing “Ctrl + 0” when running the “text-scale-adjust” command.

Method 3: Permanent Solution

The last method to increase the font size in Emacs is setting the preferred font size in your Emacs configuration file.

Locate the configuration file. It is either the “~/.emacs” or “~/.emacs.d/init.el”. Next, add the following statement:

(set-face-attribute ‘default nil :height 120)

 

The given statement sets your font size to 12 pt. Feel free to adjust it depending on how you see it best. Lastly, save the configuration file and restart Emacs. With that, Emacs will increase your font size based on the attributes that you specified in the configuration file.

Conclusion

Emacs allows its users to adjust the font size for the global buffers or their current buffer. This guide provided three methods that you can use to increase the font size in Emacs on Linux. Try each method, see which works best for your needs, and stick to it.

Share Button

Source: linuxhint.com

Leave a Reply