Babiker Osman wrote:
Hi
I am looking for appropriate arabic fonts to integrate
with vim and how can i set it
babiker
The following assumes that you have a gvim version with Arabic support. Try
:echo has("arabic")
If the answer is nonzero (normally 1), it's OK. If it's zero, you need to find
a more powerful executable.
Setting the font in gvim means setting the 'guifont' option. This involves
several steps:
- finding a fixed-width font with Arabic glyphs (Vim cannot use variable-width
fonts);
- ascertaining how your version of gvim names that font;
- writing the proper line into your vimrc.
In my experience, the Courier New font is one of the rare monospaced fonts
which includes Arabic glyphs. Now *any* monospaced font will make Arabic look
ugly, but ugly is better than nothing.
Another difficulty is that there are several different, incompatible formats
for the 'guifont' version, depending on which GUI flavour is compiled into
your gvim.
Try pasting the following code snippet into your vimrc:
if has("gui_running") " only the GUI can set the font
if has("gui_gtk2") " GTK2 only, not GTK1
set gfn=Courier\ New\ 10
elseif has("gui_photon")
set gfn=Courier\ New:s10
elseif has("gui_kde") " the obsolete kvim
set gfn=Courier\ New/10/-1/5/50/0/0/0/1/0
elseif has("x11") " other X11 GUIs, including GTK1
set gfn=*-courier-medium-r-normal-*-*-100-*-*-m-*-*
else " non-X11 GUIs
set gfn=Courier_New:h10:cDEFAULT
endif
endif
This should sniff your GUI flavour and set a first-approximation Arabic font.
The next step is checking whether you like the size. You can do this as follows:
1. Start gvim with a vimrc including the above snippet.
2. Enter
:setlocal arabic
then
i
to start Insert mode.
3. Type something in Arabic. It should appear near the top right of the
editing area.
If you want a bigger or smaller size, then hit <Esc> to go back to Normal
mode, and then
:set guifont=<Tab>
where <Tab> means "hit the Tab key". Vim will insert the current 'guifont'
value, with escaping backslashes if and where needed. You may edit it (the
first or only number is the font size), using <Left> and <Right> to move the
cursor, and, after making changes, <Enter> to accept or <Esc> to cancel.
Repeat until you like what you see (apart from the fact that Arabic always
looks ugly in monospace).
Once you have found which size pleases you best, enter the value into your
vimrc by modifying the appropriate line in the code snippet shown above.
See ":help arabic.txt" for more details about the specifics of Arabic editing
with gvim.
Best regards,
Tony.
--
A door is what a dog is perpetually on the wrong side of.
-- Ogden Nash