When inserting uncommon mathematical unicode symbols (normally through font-lock-add-keywords), I experience this issue that when my default font does not have a particular character, another font that includes that character is used instead.
Somehow, the height of the symbol in the second font is sometimes different from the height of all the regular characters in the first font, off by maybe one pixel. This changes the current line's height, and "moves" much screen text up/down by a pixel when I type a symbol, which is quite irritating. (The default substitute font that causes this problem is Arial.)
I currently solve this by using something like this, when "Source Code Pro" is the default font:
(set-default-fontset "fontset-default" '(#x???? . #x????) "DejaVu Serif")
The range is something like 2100..23ff, 27c0..27ff, 2900..2bff. Sometimes this doesn't work when I find out that DejaVu Serif also doesn't have the character, and I need to find yet another font with the same height that does. This is in emacs 24.3, on OS X 10.9.3.
A related issue is that for some characters a different font (different height) gets used depending on whether the character is highlighted inside selected region.
Why does this happen, and what can I do about it? I don't especially care which font gets used, so long as line heights don't jump. Any suggestions? Is there any way I can adjust the height of the second alternative font to be exactly the same?
±
, you can make it bigger or smaller. Each time you come across a new offending character, decide what size you want it to be and add it to your ever-growing list.lawlist-checkmark
is smaller than my default font. Here is something I enable when turning on a particular minor-mode -- it has a special symbol, so I cannot make this comment a fancy shaded grey: (dolist (my-keyword '(("✓" (0 lawlist-checkmark)) )) (unless (memq my-keyword font-lock-keywords) (font-lock-add-keywords nil `(,my-keyword))))(defvar lawlist-checkmark (make-face 'lawlist-checkmark)) (set-face-attribute 'lawlist-checkmark nil :background "black" :foreground "yellow" :bold t :height 150)