Manuel Mall wrote:

After that we really need to redesign the line breaking stuff. Not the Knuth approach (and the implemented algorithms related to that) but the way we arrive at the Knuth sequences and iterate and process the text elements. This needs to be done to be able to do white-space-treatment, UAX#14 line breaking, start- /end- space resolution and generally to be able to handle some more aspects of Unicode (e.g. glyph merging).


Just trying to write down a few thoghts and summarise what we have already said about this:

- the inline LMs can directly apply the linefeed-treatment property (ignoring, preserving or transforming the LF character) but have too much a limited "view" to handle correctly white-space-treatment and white-space-collapse, and to count the number of letter spaces

- the LineLM has to collect the "text" from its descendant nodes: non-textual objects should be taken into account too, as, for example, a leader between two spaces should prevent them from being collapsed; if spaces collapse only if they come from sibling nodes, this could maybe be handled during the collection by the InlineStackingLM

- the LineLM should then mark spaces that must be removed because they are trailing / leading, glyphs that must be merged (but which LM will paint them if the characters come from different text nodes?) and find the breaking points according to the unicode rules

- the LineLM should give someway the computed information to the descendant LM, that would use it to create at once the correct elements

- the resulting sequences would be ready for the breaking phase, without further analysis / checks / substitutions / changes

The revised interface for inline LMs could then have (just a quick idea) a new appendText(StringBuffer) method and a modified version of getNextKnuthElements() having some extra parameter storing the information created by the LineLM; we should finally get rid of addALetterSpaceTo(), getWordChars(), hyphenate(), applyChanges() and getChangedKnuthElements().

WDYT?

Regards
    Luca

Reply via email to