Wednesday, November 28, 2018

Re: Typing Persian (Farsi) in Vim

On Wednesday, November 28, 2018 at 8:39:04 PM UTC+1, Bram Moolenaar wrote:
> Bahman Eslami wrote:
>
> > > On 27 Nov 2018, at 23:17, Bram Moolenaar <Bram@moolenaar.net> wrote:
> > >
> > >>
> > >> On Monday, April 30, 2018 at 9:58:54 AM UTC+2, Bram Moolenaar wrote:
> > >>> Felipe Vieira wrote:
> > >>>
> > >>>> I have tried the above solution and the following:
> > >>>>
> > >>>> http://vim.1045645.n5.nabble.com/arabic-font-td1161759.html
> > >>>>
> > >>>> Still can't get Farsi to work. I get those "<200d>" characters.
> > >>>>
> > >>>> I have tried gvim with
> > >>>>
> > >>>> :set guifont=Courier\ New\ 10
> > >>>>
> > >>>> For instance.
> > >>>>
> > >>>> Website for example:
> > >>>>
> > >>>> http://www.unics.uni-hannover.de/nhtcapri/persian-alphabet.html
> > >>>>
> > >>>> It displays nicely on my firefox.
> > >>>
> > >>> The Farsi support in Vim is outdated. It doesn't work with Unicode.
> > >>> We are waiting for someone to re-implement it, or merge it with the
> > >>> Arabic support.
> > >>
> > >> I also wonder why there is no option to disable farsi or arabic on vim
> > >> compile. The terminal I use supports bidi text, so in order to build
> > >> the vim correctly for my terminal, I have to change config and
> > >> features file in the source to disable farsi and arabic, which is
> > >> inconvenient if I want to keep updating the vim.
> > >
> > > What do you mean? There are both options and features to enable/disable
> > > Arabic and Farsi. E.g. there is FEAT_ARABIC and the 'arabic' option.
> > >
> >
> > I mean while compiling there is no flag for disabling 'farsi' or 'arabic'. I know I can change the source code for FEAT_ARABIC (which is how I do it now) but that's not the way to go for long run in a case vim gets updated. The reason I want to disable them using flags is because I use the 'huge' flag for building the vim from the source. Actually someone suggested this flag a year ago using a patch but it didn't went through:
> >
> > https://github.com/vim/vim/pull/1867 <https://github.com/vim/vim/pull/1867>
>
> That patch has slipped down in the todo list, I'll move it up a bit.
>
> > I think adding the disable flag for these features would be helpful
> > since many text engines do the bidi rendering nowadays and enabling
> > these features is just useless and for my case destructive.
>
> I don't see how disabling the feature at build time is required. If you
> don't set 'arabic' then that is the same, right? If not, please explain
> what goes wrong with just building with FEAT_ARABIC.

Hey Bram,

In a case a user doesn't want to have arabic nor faris in the vim, they can build the vim with the 'normal' feature flag but they would miss other features like langmap, but if they want to build it with langmap feature, they need the 'huge' feature flag which also includes the arabic. There is also no flag to disable nor enable arabic while building the vim. So the only way to disable them is to change the source which is how I do it. Now I give you an example what goes wrong with the arabic enabled. I use the native terminal app in OSX which supports bidi text perfectly even when it comes to selecting text. So if you take the below text sampe which contains bidi text and put it in the vim you can see that the result is correct only when the arabic is disabled. I can't say for other terminals or environments if it works correctly but any user can compare the rendering from their web browser which supports bidi text as you can see in the following line:

English text متن فارسی another text

So if the vim rendering of the top text example matches the rendering of your browser, then it's correct. I've also attached two sample images which one uses the vim with arabic enabled and one with arabic disabled and you can see the incorrect rendering of text using the arabic enabled. Even selecting the text is wrong with arabic enabled. I can also confirm that macvim also shows incorrect result with arabic enabled even though it's using a gui font.

Best,
Bahman

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: