In article <516519f8.2070...@lyx.org>, Jean-Marc Lasgouttes <lasgout...@lyx.org> wrote:
> 09/04/2013 23:12, pdv: > > I've adapted rowBreakPoint() and also removed the following call to > > rowWidth(), where the same calculations are done again. > > The on screen layout is now OK, except for a small remaining issue with > > RTL-languages. > > Yes, we should not have several pieces of code that do the same > calculations. What is the data structure that you use to remember the > row characteristics? I do now all the width-calculations in one function. In that function the widths are cached in a map<docstring,int>. I then obtain again a substantial speed increase. For testing I defined a static map, but I assume that eventually the map should be stored in a suitable object so that the map doesn't grow out of proportion. > > I also notice that the inlineCompletion code is polluting the > TextMetrics code, I wonder why the completion string is not just > inserted in the paragraph and removed by the DEPM mechanism. I suspect > this would be cleaner. So far I can handle all basic content properly. I haven't paid much attention to inlinecompletion (at one point it posed no problem, but I have to check that again), but I just discovered an issue with the Labeling style ... > > > Unfortunately the extra time taken to calculate the correct widths in > > rowBreakPoint() eats too much of the time gained gained by avoiding > > single_character_painting and although still somewhat faster than before > > I find the scrolling speed again no longer acceptable. > > > > It looks indeed that this can only be solved by caching the widths. > > Yes, probably. Remember also that a bit of profiling can help. Just > reconfigure with --enable-build-type=prof and use Shark.app on LyX. > > Finally, there is probably some parallel effort from Lin Wei (look for > the "Word wrapping problem" thread) for breaking rows properly in > chinese/english documents. I suspect that this work will become easier > to get right after you have put all the word breaking code in one place. I've posted a reply to that thread. > > JMarc