arabic font

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

arabic font

Babiker Osman
Hi

I am looking for appropriate arabic fonts to integrate
with vim and how can i set it


babiker

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
Reply | Threaded
Open this post in threaded view
|

Re: arabic font

A.J.Mechelynck
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
Reply | Threaded
Open this post in threaded view
|

Re: arabic font

A.J.Mechelynck
In reply to this post by Babiker Osman
Babiker Osman wrote:
> Hi
>
> Thanks Tony  for your help
>
> :echo has("arabic")
>
> The answer is  1
>
> I did the pasting  however

Did you (re)start gvim with the modified vimrc?

>
> Vim will insert
> the current 'guifont'  value, with escaping ackslashes
> if and where needed.
>
> Does'nt work

What do you see after:

1) pasting the code snipped I gave you into your vimrc
2) restarting gvim
3) typing

        :set gfn=<Tab>

(where <Tab> is not 5 characters but just hitting Tab)

Your ":set" statement should be filled-in and you should be able to do
command-line edition on it.

>
> I chose Courier New 10 from vim menu  it works
>
> However when i compile for tex output file is empty
> Best regards
> babs


I don't know Tex. What is "compiling for tex output"?

Vim is capable of writing a plaintext file. If you want to pass your current
editfile to a different program, you must
- either save it (using ":w" ot maybe ":saveas <filename>" where <filename> is
any new name under which you want to save the file, then pass the (saved) file
to the external program,
- or invoke the external program as a filter and pass a range of lines to it
(see ":help filter").


Best regards,
Tony.
--
The United States is like the guy at the party who gives cocaine to
everybody and still nobody likes him.
                -- Jim Samuels