Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Basically, I replaced all methods in the font_metrics
Abdelrazak> namespace by a proper virtual interface FontMetrics. The
Abdelrazak> FontLoader is _the_ container for FontMetrics.

Abdelrazak> This patch should also bring some optimisation in a number
Abdelrazak> of place in the code. This is because we do not need any
Abdelrazak> more to search for the LyXFont at each font_metrics call.

So what you gain is the lookup in the 5-dimensional array, right?

Yes.


Abdelrazak> In effect, the speed advantage is not as sensible and this
Abdelrazak> is a bit deceiving considering that this was my primary
Abdelrazak> motivation behind the patch.
Accessing an array is rather cheap, so it is not a huge surprise...

Well as the searching was within loops all other the place I hoped that the accumulated small gains will show. But maybe it will show on linux and Mac.


Abdelrazak> But I like the patch anyway as it cleans up the relation
Abdelrazak> and interfacing between fonts, metrics and frontends.

I am not sure the gain is worth the big code change... But I am not
the one who does it!

The code is cleaner this way to my eyes and it is more understandable. So in this sense I think it was worth it.


Abdelrazak> Ideally, we shall not use any of these frontend metrics in
Abdelrazak> the "kernel" but that's a pretty far goal for now.
How would you do that?

Following the approach described below. The problem is that we reconstruct and store the screen metrics too much. I don't see why we cannot exploit more the metrics as given following the painting operations.


Abdelrazak> Some of these call can be eliminated if we change
Abdelrazak> Painter::text() to return the width of the drawn text
Abdelrazak> instead of recalculating it afterwards. I will do that
Abdelrazak> once this patch is in.

This seems much more promising.

It's the same really...

Abdel

Reply via email to