On Tue, Oct 17, 2006 at 02:11:55PM +0200, Georg Baum wrote:

> Am Dienstag, 17. Oktober 2006 13:51 schrieb Enrico Forestieri:
> 
> > The problem here is that a string iterator has type "pointer to char",
> > which by default is signed on Cygwin. So, the ascent() functions was
> > being passed an unresonably large (and wrong) value for nonascii chars.
> 
> Good detective work!

I managed to compile LyX with debugging symbols, so it was easy to spot.
However, now it takes half an hour only to link the thing and the computer
is unusable in the meantime :(

> > The solution here is to convert to unsigned char before calling ascent()
> > and descent().
> > 
> > With the attached patch I don't get crashes anymore. I will commit it
> > shortly if nobody objects.
> 
> I don't think that this solution is the right one. The argument "s" of 
> mathed_string_dim is in utf8 encoding (since all mathed stuff is read in 
> uncahnged from the .lyx file). That means that we may not get the metrics 
> by iterating through the bytes of s. We rather need to convert it first to 
> ucs4, and then we can call ascent() for each character, see the attached 
> patch.

Yes, you're right, of course, but I am currently out of the unicode
details, as I am spending most of the time I can spare to try to let it
compile and run without crashing. This leaves me with almost no time to
understand what is going on and if a string is really an utf8 thing...

> That will probably slow down math quite a bit, but the long term solution 
> is to convert mathed to docstring completely.

I am going to test the last patch in this direction from Abdel.

-- 
Enrico

Reply via email to