On 09/15/2010 01:22 AM, Uwe Stöhr wrote:
Am 14.09.2010 15:26, schrieb Abdelrazak Younes:

You would very much help me very much if you could look at the code. As said my problem is that the value "w" (the text width) is calculated in TextMetrics::redoParagraph. I need to have this value in InsetLine::draw. I didn't find a better solution for this than to use a global variable
and are now looking for an alternative.

So you just need the inset width AFAIU which happens to be egal to the text width of the enclosing
text inset... I guess this is a simple patch, I'll have a look.

No, this is wrong. I need the text width and not the inset width! As I wrote, the text width is calculated in TextMetrics and I need this value in InsetLine.cpp. So I only need to replace there the wrong pi.base.textwidth with the value calculated in TextMetrics (a.k.a. know as mi.base.textwidth).

No Uwe you are just plain wrong! And I am quite upset about your revert if only because I have much more knowledge than you in this stuff. If the drawing was not 100% correct in my commit then you should fix it from there not by going back to your ugly code. And I really mean it, this code is really ugly and buggy, besides being completely wrong.

The inset width as calculated by the metric() method is exactly what you want. In case the inset is 100%col then the inset width is exactly the text width of the enclosing inset. But of course this is not the case if you set it to less than 100%. Contrarily to you I have tested my code and it was correct with regards to the surrounding text. It was perhaps not correct with regards to LateX because I removed what seemed wrong to me: your mixing of heigth and width in the drawing code. But as I said above, you should have worked from there.


That's the whole problem.

Your commit r35373 destroyed the dimensions of the drawn line. I therefore reverted the buggy part of this commit. All that needs now to be done in InsetLine.cpp is to replace pi.base.textwidth with the text width.

This revert is plain stupid. The time you spent on programming this is irrelevant, see below.


// FIXME: text_metrics_.width() is only about 1.0857 * mi.base.textwidth
pi_.base.textwidth = text_metrics_.width();

You can ignore this, my patch reverts this.

I wanted to know where this value of 1.0857 came from...

mi.base.textwidth is the "w", calculated in TextMetrics::redoParagraph and gives on my PC the value 630. As I don't know tow to get this value in InsetLine::draw, I used as workaround text_metrics_.width() which gives 684 on my PC. So currently I used the wrong value 684 to draw the line instead of the correct value 630.

The problem is that you program empirically... you add a snip of code there and there in order to go from 630 to 684... then another session will give you 520 but what you really want is 564 so you will add again some more code... etc.

Abdel.

Reply via email to