Monday, July 16, 2012

Re: vim fonts change with time and with computer

On 16/07/12 04:51, AndyHancock wrote:
> I've got font increment key mappings such as:
>
> map <C-F6> :set guifont=Monospace\ 8<CR>
> map <C-F7> :set guifont=Monospace\ 9<CR>
> map <C-F8> :set guifont=Monospace\ 10<CR>
> map <C-F9> :set guifont=Monospace\ 11<CR>
> map <C-F10> :set guifont=Monospace\ 12<CR>
> map <C-F11> :set guifont=Monospace\ 13<CR>
> map <C-F12> :set guifont=Monospace\ 14<CR>
>
> Over the years, I've found that it can take countless hours to choose good fonts, and it's also pretty important when you're staring and many source files simultaneously.
>
> Lately, I've encountered puzzling behaviours in how gvim handles font selections which could partially explain why font refinement takes such a long time when I migrate my settings to a different PC or when I find that my past font selections seem oddly unsatisfying, for some strange reason.
>
> The first is that when I use the GUI menu to select fonts (Edit->Select Font), the list of font names seem to change based on factors that I haven't been able to identify yet. That is, I could see a font name on the list and later not see it.
>
> The second is that the exact same fonts (such as the ones above) look different on different computers. That is, it will be sans serif on one system and not another. Like a completely different font. I am pretty sure that the font libraries are the same because I use the same cygwin x-windows install packages. What might cause this?
>

"Edit→Select Font" runs ":set guifont=*". This displays a dialog showing
- all installed fonts, if running in gvim with GTK2 GUI
- all installed *monospace* fonts, in other GUI flavours

The commands you show above are only valid in gvim with GTK2 GUI. In
other gvim flavours (such as Windows, or macvim, or Motif) these
commands are not valid, but (if issued in the vimrc) they will set some
default font, in my experience usually an ugly one.

In any case, "Monospace" is a generic family; from one computer to the
next it might be implemented using different (sometimes very different)
font faces. If you use a specific font name instead, for instance

if has('gui_running')
if has('gui_gtk2') " but not GTK1
set gfn=Courier\ 10
elseif has('gui_photon')
set gfn=Courier:s10
elseif has('gui_kde') " the obsolete kvim
set gfn=Courier/10/-1/5/50/0/0/0/1/0
elseif has('mac') " Mac incl. MacVim
set gfn=Courier:h10
elseif has('x11') " OTHER X11 including GTK1
set gfn=-*-courier-medium-r-normal-*-*-100-*-*-m-*-*
else " assume DOS / Windows
set gfn=Courier_New:h10:cDEFAULT
endif
endif

the results should be much more uniform, even on different gvim flavours
and/or different operating systems. (Each gvim flavour accepts only one
of the six 'guifont' formats shown, and console-only Vim accepts of
course none of them.)

In each case, the first or only number is the font size.


Best regards,
Tony.
--
ARTHUR: Will you ask your master if he wants to join my court at
Camelot?!
GUARD #1: But then of course African swallows are not migratory.
GUARD #2: Oh, yeah...
GUARD #1: So they couldn't bring a coconut back anyway...
The Quest for the Holy Grail (Monty
Python)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment