DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=36004>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=36004 ------- Additional Comments From [EMAIL PROTECTED] 2005-08-03 22:33 ------- Implementation notes ==================== KnuthSequence now has a variable and a method declaring whether it contains a sequence of inline or block Knuth elements. getNextKnuthElements() of InlineLevelLMs construct and return a list of KnuthSequences. During the construction, if the last sequence is an inline sequence, it is kept open for addition of further returned inline Knuth elements (lastSequence != null). While it is open, newly received inline sequences are added to it. It is closed when a received inline sequence is ended by a negative infinite penalty, which signals a forced line break, or when a forced line break is read (TextLM). Those InlineLevelLMs that can have BlockLevelLM children, turn the list of Knuth elements that they receive from their BlockLevelLM children into a block sequence, after having wrapped their positions. Before they add this sequence to their return list, they close the open inline sequence. They create a separate sequence for each block level child LM. LineLM, collectInlineKnuthElements: inline Knuth sequences are turned into paragraphs. The positions of the elements of block sequences are wrapped. knuthParagraphs is a list of Paragraphs and block KnuthSequences. Represent each block sequence (one line area) by a LineBreakPosition, with iParIndex as the index of the block sequence in knuthParagraphs. The LBP must be placed as lineLayoutsList.possibilitiesList.breakPositions, in agreement with the placement of LBPs of inline sequences. The type of the block sequence leads to different processing in addAreas: an iterator over the block sequence, the child area being placed in a single line area (and the block areas must be children of a single inline area, which is a descendant of the child area of the line area). State diagram of InlineLM: Possible states: I: lastSequence != 0 && lastSequence.isInlineSequence() B: lastSequence != 0 && !lastSequence.isInlineSequence() 0: lastSequence == 0 Start state = 0 InlineLevelLMs return a list of Knuth sequences, mixed inline and block; each returned sequence is a separate event BlockLevelLMs return a list of Knuth elements Possible events: ILM(i): InlineLevelLM returns inline sequence ILM(ic): InlineLevelLM returns closed inline sequence ILM(b): InlineLevelLM returns block sequence BLM(s): BlockLevelLM, curLM == lastLM BLM(o): BlockLevelLM, curLM != lastLM BLM: BlockLevelLM = BLM(s) or BLM(o) Symbols: [ I: open new lastInlineSequence and add to return list, add returned inline sequence [ L: open new lastBlockSequence and add to return list, add returned list + I: add inline sequence to existing lastInlineSequence + L: add list to existing lastBlockSequence ]: close sequence B: add block sequence to return list Transitions: 0 - ILM(i): [ I, state becomes I - ILM(ic): [ I ], state remains 0 - ILM(b): B, state remains 0 - BLM: [ L, state becomes B I - ILM(i): + I, state remains I - ILM(ic): + I ], state becomes 0 - ILM(b): ] B, state becomes 0 - BLM: ] [ L, state becomes B B - ILM(i): ] [ I, state becomes I - ILM(ic): ] [ I ], state becomes 0 - ILM(b): ] B, state becomes 0 - BLM(s): + L, state remains B - BLM(o): ] [ L, state remains B The routine may end in states 0 or I. Technically it can also end in state B, but the parent LM will never consider a returned block sequence as open; therefore ending in state B is effectively ending in state 0. An inline sequence must be closed by an explicit negative infinite penalty, so that the parent LM can see that it is closed. A block sequence is implicitly closed. Only its creator can add elements to it. State diagram of InlineLevelLMs with InlineLevelM children: Possible states: I: lastSequence != 0 0: lastSequence == 0 Start state = 0 InlineLevelLMs return a list of Knuth sequences, mixed inline and block; each returned sequence is a separate event Possible events: ILM(i): InlineLevelLM returns inline sequence ILM(ic): InlineLevelLM returns closed inline sequence ILM(b): InlineLevelLM returns block sequence Symbols: [ I: open new lastInlineSequence and add to return list, add returned inline sequence + I: add inline sequence to existing lastInlineSequence ]: close sequence B: add block sequence to return list Transitions: 0 - ILM(i): [ I, state becomes I - ILM(ic): [ I ], state remains 0 - ILM(b): B, state remains 0 I - ILM(i): + I, state remains I - ILM(ic): + I ], state becomes 0 - ILM(b): ] B, state becomes 0 For block sequences we do this whole process (adding a LineBreakPosition to a layout possibility) in LineLM.createBlockLineBreak. We add one layout possibility, with 1 line and 0 demerits. Then we create one linebreak position for the sequence. The parameters for the linebreak position are as follows: LineBreakPosition lbp = new LineBreakPosition (this, knuthParagraphs.indexOf(seq), seq.size() - 1, lineShrink, lineStretch, 0, // difference 0, // ipd adjustment 0, // adjust (= bpd adjustment?) 0, // start indent lineHeight, 0, // line width 0, // baseline 0, // topshift 0); // bottomshift As a bonus for using the same complicated data structure also for block sequences, in postProcessLineBreaks, inline and blocksequences are treated alike. The only difference is in fetching the footnote list, which needs to be copied from the contained KnuthBlockBoxes. Adding areas: InlineLM is supposed to return an InlineArea, but InlineAreas cannot contain a block area. Created a new type, InlineBlockParent. AbstractRenderer.RenderInlineArea must recognize InlineBlockParent. Each renderer must have a method RenderInlineBlockParent. Implemented for AbstractRenderer, XMLRenderer. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.