Thanks for taking the time to reply. It is very useful to discuss this with someone who has an idea of how layout works.
This loop only counts word spaces.
Yes, I know, but I believe it should do more than that.
Later the member iTSadjust is set
on the text area: t.setTSadjust(iAdjust / iWScount). It seems that
this is supposed to take care of space stretching, I do not know
The renderer should add this to the X offset for every piece of text it places in the renderText method. It is missing ATM, but it is easy enough to add.
I guess the renderer should know how to use this information. In
my test runs, it is equal to 0, which explains the lack of
TSAdjust is set to zero because iAdjust is always zero in TextLM.addAreas. And this is always zero because it is based on a difference between min/opt/max of the ipdArea, but these are always the same in TextLM.getNextBreakPoss. I'm going to change this to set TSAdjust to dAdjust.
I am not sure whether it is necessary to break up the text area into pieces.
The trouble is renderText is being presented with a whole line at a time. It should be presented with smaller chunks if it is going to be able to add the TSAdjust space to each word space.
The real calculations are happening much earlier, in the
getNextBreakPoss loop. In LineLayoutManager.makeLineBreak, ipdAdjust
and dAdjust are calculated based on the length of the line, and set as
members on the new linebreak position.
I also believe dAdjust is computed incorrectly. I'm going to change the dAdjust in LineLM.makeLineBreak to be targetWidth - realWidth instead of (targetWidth - realWidth) / realWidth. Have you got any ideas why dAdjust is computed this way?
In the ensuing addAreas loop, LineLayoutManager.addAreas fetches these again from the linebreak position and sets them on the layout context. From there they are fetched by the above calculation and used in calculating iTSadjust -- with little succes at the moment.
ipdAdjust seems to be for scaling between min, opt and max. dAdjust seems to be the scaling for justification.
Yes I think you're right.
These are my thoughts on the process.
The whole thing is much clearer now Ive talked it over with you. Thanks once again,