On Thu, Mar 28, 2002 at 12:21:20PM +0100, Jean-Marc Lasgouttes wrote: > However, it seem that the huge amount of font tokens we get in this > case is related to the fact that textinsets do not make any effort to > reduce their fonts agains outside world (look at UserGuide.lyx...). > > Presumably the code should differentiate between insets which inherit > font from the outside (are there some) and those who reset fonts. > There is really a lot of bloat in lyx files due to that.
I fiddled around with "font insets" for mathed lately, and by now I am fairly convinced that this is the Right Thing to do. It is much more "logical Markup", it is basically what LaTeX does, and it is what Docbook does (if that's what José said). I don't think it is what "conventional word processors" do, but to be honest, I don't care. I don't know how big a change this would be for 'main LyX', as it is already such a big change for mathed that I won't try to sneak it into 1.2.0 [and new insets are really easy in mathed nowadays...] The change, however, _is_ nice: It's about 200 lines _less_ code right now and it removes almost all font related hacks (like passing a font change through macro arguments...). So the change just 'feels good'. > ANother candidate would be Paragraph::insertChar, which is called a > lot during parsing (and maybe other places) for inserting at the end > of paragraph. Obviously in this case there is no need to search/update > the fonttable/insettable. Luckily enough for 1.2.0 release date, I > will not have time to look at it :) This problem, e.g. is magically solved by simply doing font related stuff only if drawing is requested. Just push_back() the char to the container... - For the 'speed of string comparison matter': Somewhere in one of my older projects I had some class wrapping a 'const char *' and a hash values of the string for exactly that purpose. I seem to remember a speedup of four or five or so. So if this is really crucial, I can dig this out (or re-invent the wheel which is probably better for the stomach contents than looking at six years old code...) Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)