How do change the font size in spacemacs? Do I need to download additional packages such as source code font?
I tried changing the font size in the configuration file, but the font size does not change. I am having trouble installing source code font, because the font paths are not registered correctly. The fonts were installed via the instructions provided by open source Adobe. Is there an easier way to do such a simple task in spacemacs?
Another way is to use the key sequence "SPC z x" and then press "+/=" key to increase font size or "-" key to decrease font size. Other options are shown on the which-key menu.
In my .spacemacs file I have the following
(defun dotspacemacs/init ()
(setq-default
dotspacemacs-startup-lists '(recents bookmarks projects)
dotspacemacs-default-font '("SourceCode Pro"
:size 18
:weight normal
:width normal
:powerline-offset 2))
Of course you should change the font to your liking. The powerline has some char that goes well with the powerline in spacemacs.
To get to .spacemacs simply type SPC f e d to reload the new file type SPC f e R.
This should do it.
And yes I am an old man with less than optimal eyes, hence the rather large font.
If you don't want to change the default settings or want to change the font size without restarting emacs, try:
M-x text-scale-increase
Another way I do it (at least in Ubuntu 20.04) is to click CTRL and move the scroll wheel on your mouse or touchpad to increase/decrease the size of the text.
Related
I'm intending to increase the height of each line in Spacemacs. I tried to put some code into user-config block in the .spacemacs file in my home directory like below, but the line height doesn't change at all:
(defun dotspacemacs/user-config ()
'(add-text-properties (point-min) (point-max)
'(line-spacing 0.25 line-height 1.25))
)
Does anyone know how to do this in Spacemacs? I have just started to use Spacemacs for a week so I'm totally a newbie.
In addition to the other answers, you can the emacs UI to customize the vertical spacing. You do this by:
1. M-x
2. Type customize variable then press enter
3. Type line-spacing then press enter
You'll be taken to a UI menu for customizing the line spacing variable.
On the line that says line spacing, go to the button that says value menu, press enter, press 1 to use a custom value. Then in the box to the right, you can change the value from 0.0 to whatever you'd like!
Then make sure to hit the save and apply button!
After a while searching for the solution, I found out that there are lots of tricks to do to increase the line height, while keeping the text appearing at the center of the line. So I tried to modify the font instead using FontForge (increase the top and bottom space of the font).
For people who may want to achieve the same thing, I'd like to say that using FontForge to create a new font that suit you is far easier than finding a way to do it via configuration in Spacemacs.
Just for information, evaluating (setq line-spacing 2) in a buffer increases the line spacing.
You can add (setq-default line-spacing 2) to your .emacs file to change it globally. setq wouldn't work because line-spacing is a buffer-local variable.
How can I auto run a function when open a new buffer, say text-scale-adjust.
A slightly more detailed version of abo-abo's answer:
(add-hook 'find-file-hook
'(lambda () (text-scale-adjust 1)))
This will run for all files you visit. You can look at mode-specific hooks if you want to tailor which types of files/buffers get this treatment.
You could take a look at these hooks, as well:
after-change-major-mode-hook
change-major-mode-hook
change-majory-mode-after-body-hook
first-change-hook
window-configuration-change-hook
But can you clarify what the aim really is?
If you just want to make all buffers display with larger or smaller text, then it is enough to do one of the following:
Choose from the menu bar: Options > Set Default Font....
Put this in your init file: (set-frame-font "THE FONT YOU WANT, WITH THE PROPER SIZE" nil t)
Set the default font size for all frames to what you want, at the outset, simply by customizing default-frame-alist wrt frame parameter font.
IOW, set the font size for your frames, rather than scaling the text of all buffers.
If I do M-x customize-face RET default I can adjust the default face (font) in Emacs.
There are several options, all of them explained in the documentation. Many of these options can be selected from a menu when you select/click on Value Menu, but not the Font Family.
How can I see a list of the fonts that I can use in Font Family in Emacs?
Type the following in the *scratch* buffer, and press C-j at the end of it:
(font-family-list)
You may need to expand the result to see all of them, by hitting enter on the ... at the end.
If you are using Emacs 23.1 or later on the X Window System, the following fc-list command can list font families available on your system for Emacs (or any application using fontconfig):
$ fc-list : family
I've been attempting to alter the font / face for the emacs minibuffer separately from emacs default fonts, but without much luck.
Specifically, I'm interested in making the minibuffer font size larger for use with the emacs MULE as, with my current font setting or if I'm using emacs on a "netbook" screen, sometimes the character selection options in the MULE are a bit small.
Options easily accessed within emacs are the minibuffer-prompt & minibuffer-prompt-properties, but these are only for command prompts and not the regular minibuffer text.
There seem to be a number of minibuffer variables listed in emacs for creating minibuffer frames, or getting contents from minibuffer windows, etc.. but these do not pertain to altering the minibuffer face. Is it even possible to alter the minibuffer face separately from the default emacs?
An interesting option is the oneonone emacs http://www.emacswiki.org/emacs/OneOnOneEmacs project. But could the dedicated minibuffer frame be altered? Also before I alter my current emacs set-up that drastically, I'd hope to be able to just alter fonts first or create my own alterable minibuffer frame, etc...
Any help and/or creative ideas would be greatly appreciated.
You can add customization to the minibuffer through the minibuffer-setup-hook. In there, you can do some face remapping like so:
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup)
(defun my-minibuffer-setup ()
(set (make-local-variable 'face-remapping-alist)
'((default :height 2.0))))
Change the body of the my-minibuffer-setup as desired. The above doubles the height of the default face.
Yes, you can easily customize the properties of a standalone minibuffer frame, including its default face and font.
You can customize the OneOnOneEmacs user option 1on1-minibuffer-frame-alist. (Or you can customize the standard option minibuffer-frame-alist -- its frame parameter values are used as defaults by 1on1-minibuffer-frame-alist.)
The font frame parameter is the one that controls the font (duh). So you would customize option 1on1-minibuffer-frame-alist, changing its setting for the font.
Alternatively, you can just set 1on1-minibuffer-frame-font to the font you want -- it is used as the default value for the font setting by 1on1-minibuffer-frame-alist whenever there is no explicit font setting in minibuffer-frame-alist. For example:
(setq 1on1-minibuffer-frame-font
"-*-Lucida Console-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
If you do not want to use a standalone minibuffer frame then see Trey's answer.
I am using emacs 23 on my Ubuntu netbook edition. Every app, automatically goes to fullscreen (so does my emacs). But depending on the font size (:height), I get a smaller working window.
If I go to :height normal I get the full area but the fonts are HUGE!
any ideas?
Your window manager is broken. emacs resizes itself when you change the font size (this happens during startup). Your window manager should tell emacs that emacs was resized by the window manager, at which point everything will work normally.
Anyway, start emacs as "emacs --daemon" and connect with "emacsclient -c" and you should not notice this problem.
OK, so actually I added this to my initfile:
(add-hook 'after-make-frame-functions
(lambda (frame)
(progn
(add-to-list 'default-frame-alist
(cons 'height
(/ (x-display-pixel-height)
(frame-char-height)))
(add-to-list 'default-frame-alist
(cons 'width
(/ (x-display-pixel-width)
(frame-char-width))))))))
and now the window is the same size as the full screen. If you are setting your fonts inside of the after-make-frame-functions hook then it is important that this comes first in your initfile, (I think because hooks are run in reverse order) but if you're just setting the fonts then this should work OK anywhere.
Of course for maximum safety you could put this and your 'set fonts' stuff into the same defun, with this coming after the fonts have been set.
EDIT:
This is a slightly more forceful way to do it, in case that doesn't work.
This gives me some issues though, really you would probably want to subtract the height of the top panel from the height you're setting it to.
(add-hook 'after-make-frame-functions
(lambda (frame)
(progn
(set-frame-height frame
(/ (x-display-pixel-height)
(frame-char-height)))
(set-frame-width frame
(/ (x-display-pixel-width)
(frame-char-width))))))
The font size issue can be fixed simply by selecting a different size font as the default font (Options->Set Default Font), then saving the options (Options->Save Options). Emacs seems to have issues with font point sizes matching system sizes (there's discussion about X standard DPIs versus GTK standard DPIs), but if you select one that works it will stay the same.
To get the window to come up maximized correctly, I've found there's an issue with the frame alist not accounting for the minibuffer correctly as well as the different font sizes not triggering the frame to resize correctly. If you set the initial-frame-alist to include (fullscreen . fullwidth) and (minibuffer-lines . 1) it accounts for the minibuffer size correctly and comes up with the correct width, forcing an effect as if you resized the window by hand to the maximum visible area (not quite the same as maximizing). You can set these via Options->Customize Emacs->Settings Matching Regexp... Then typing initial-frame-alist. Set two new parameters and values, "minibuffer-lines" to "1" and "fullscreen" to "fullwidth".
Removing the "minibuffer-lines" parameter will give you a full screen width window that's the wrong height, and removing the "fullscreen" parameter means nothing resizes correctly. Attempting to set "fullscreen" to "fullscreen" gives the same issue as setting nothing, and "fullscreen" to "fullheight" gives blank space only across the height and not the width when a smaller font size is used.