Keiron Liddle wrote:
> Can we have a list of all font states so that it can be retrieved when
> needed for a particular layout of area?

This is exactly what I'm currently thinking about. This
allies to all property bundles. There are only so much
different font states really used in a specific document,
usually one or two for the normal text (normal and perhaps
italic), a few more for headlines, and for software docs
also one or two with Courier.
Nevertheless FOP creates half a new FontState object every
time one is needed.

I imagine the following:
- Classsify all properties in various bundles. There is
   already a bunch of them: FontState, TextState (should
   be TextDecoration) and some unused classes.
- In the constructor, get the property bundle object from
   the parent (if inheritable), or get the scratch object
   for this bundle, or create a new one.
- Go through the XML attribute list, and get a property value.
- Check whether the value is alredy in the bundle object. If
   not, and if it was inherited, clone the object. In either
   case, store the property value afterwards.
- If all properties from the XML attribute list relevant to
   the bundle are examined, go through the global table of
   already allocated objects of this property bundle. If an object
   with the same values is found, refer to this. If necessary,
   put back the scratch object for reuse.

Of course, this requires that property bundle objects are
immutable once filled from the XML attributes (and local
property refinement). There is one instance where a
BorderAndPadding is abused in Table.java, but I think this
could easily be solved otherwise.

I think this way memory usage could be significantly reduced.
I'm going to implement this in the maintenance branch after
I finissh the cleanup I'm currently doing.

What do you think?

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to