On Mon, Mar 05, 2001 at 01:24:24PM +0100, Lars Gullik Bjønnes wrote:
> | The problem is that the data in a LyXText instance is changed frequently 
> | (in the LyXParagraph::GetFont and LyXText::GetFont methods).
> | The solution is perhaps to keep the LyXFont class unchanged, but in
> | LyXParagraph::FontTable store a boost::shared_ptr<LyXFont>
> | instead of a LyXFont.
> 
> afaics it will be a lot harder then to localize the SharedContainer
> (functionality that will be needed to really save anything.)

Why?

> | Another option (without using shared_ptr) is to change the members in
> | FontBits to chars (i.e. struct FontBits { char family; char series; ...})
> | This is a bit ugly, but at least it will give a memory reduction, without a
> | slowdown.
> 
> Oh, we had that earlier, the code was close to impossible to maintain,
> won't happen. and I'd hate to loose the type information. btw. clever
> compilers are free to use a byte for most of those enums.

IIRC, we had something else: all the data was packed into a single unsigned
int, and that was indeed horrible.
With my suggestion it is not harder to maintain than the current code.
And you don't loose the type information because the interface method
(family(), series() etc.) do return the correct type.

Reply via email to