Hi,

Gautam Iyer a écrit :
> Hi Jehan,
> 
> I just did a few more tests. Your UTF-8 code handles quite a few scripts
> very nicely. Attached is a test file, and a screenshot of what it looks
> like can be found here:
> 
>     http://www.gentoo-portage.com/up_img/993.png

Nice test! :-)

> 
> I got quite a few segfaults though! For instance sometimes when I try
> and Vim a file, I get a segfault (esp. if the file has numerous mixed
> fonts). It is a little more stable if I only use one xft font.

Hum... I think to guess the reason. I have to do more checks to handle
the reality of the size fonts and the "guess" of vim. That's what I was
speaking to this ml some time ago about the fact that I found some
characters which were 1 or 2 columns wide depending on the font, for
instance the euro sign €.

I discussed this a few days ago on the vim list. I subscribed their ml
dedicated to multibyte characters (one of their recently new features)
because I wanted to know how they were "deciding" which size is a font
or not.

The problem is this one:

vim (or any other program running on terminal) does not know a character
size, but it still need to guess it. For instance when you type a letter
in vim, what it does is sending the letter for display, then sending a
command to move the cursor (I saw this when I was inspecting mrxvt with
gdb). Then you type 'a', and vim tells mrxvt "display 'a', and now go to
column +1".
The problem is that when you type '€', it thinks euro is 1 character
wide (real in 'Bitstream Vera Sans Mono' for instance). So it tells
mrxvt: display '€', then go to next column. But then if I run mrxvt with
'Sazanami Gothic' only, '€' is 2 characters, and here is what I get:
vim_with_sazanami.png

This is not mrxvt's fault. The real issue is that I don't think there is
a "command" (some escape sequence, a command to the tty through 'ioctl'
or such) to tell which size is a character you send, and this is
probably normal (it would become really complicated and this situation
was not planned probably when first terminals were designed).
But what is mrxvt's fault is obviously if it crashes. I guess there is a
test that is not done somewhere. Could you send me such a file which
would crash in vim? Is it a systematic crash?

Anyway for the problem of font size in vim, there is a workaround, try:
:set ambiwidth=double
Then you get this:
vim_with_sazanami_and_ambiwidth_double.png

That's to tell vim that when it encounters a characters which is
ambiguous (so which can be simple or double column sometimes), then it
will consider it always as double column...
Tell me also if your file still crashes with this option activated. It
can give me a hint on whether I am on the good solution to fix this.

> 
> But even then it crashes when I increase the font and decrease it again!
> 

Hum... here this works nice. I will have to study this. If you have
something more specific. For instance, which fonts do you use (and in
which order) when it occures? Does it occures in any case, even with a
single font loaded?


> Nice work! Looks very nice,
> 
> GI
> 

:-)

Jehan

<<inline: vim_with_sazanami.png>>

<<inline: vim_with_sazanami_and_ambiwidth_double.png>>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Materm-devel mailing list
Materm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/materm-devel
mrxvt home page: http://materm.sourceforge.net

Reply via email to