Re: block content in inline content

2005-12-22 Thread Jeremias Maerki
Not much to contribute here but I'm glad to see that you're working in
this area! I felt a little lonely lately. :-)

On 22.12.2005 10:13:37 Simon Pepping wrote:
> I have tried to removed the double-list return type (a list of
> KnuthSequences) of InlineLevelLM.getNextKnuthElements. I have
> abandoned those efforts.
> 
> If the return type is only a single list, the call stack has to return
> to LineLM.getNextKnuthElements for every completed paragraph and every
> sequence of block elements. This is certainly possible, and was the
> case in the past. It is true that most paragraphs consist of only one
> Knuth paragraph, and do not contain block content. For those
> paragraphs a single list return type would be efficient.
> 
> It would require look-ahead: Can the next sequence of Knuth elements
> be appended to this one? And caching the sequence if not. Probably not
> a big deal.
> 
> Nevertheless, I do not feel inspired to code this only for sake of the
> return type.
> 
> Having an inherited method with a list with different types of content
> elements will be a problem when we would ever use type-safe
> collections. I would prefer to tackle this by defining a return type
> KnuthSequences, which would be able to hold a single KnuthSequence or
> a list of KnuthSequences, with logic to handle both cases
> transparently for its clients.
> 
> I thought you may wish to know these considerations.
> 
> Simon
> 
> -- 
> Simon Pepping
> home page: http://www.leverkruid.nl



Jeremias Maerki



Re: Block content in inline content

2005-08-21 Thread Jeremias Maerki
What the hell is unfortunate about having a better idea? If that helps
make the code simpler and more easily understandable that's cool. And it
sounds like it does. I simply had to fix the problem somehow because I
want to get the first release out as soon as possible. And I was very
happy that you already provided me with something to start with (that
doesn't happen for the first time. Hey Luca!). It doesn't have to be
(and can't be) perfect in this short time. So I'm perfectly happy if you
look at this again when you have time.

On 21.08.2005 20:58:36 Simon Pepping wrote:
> Thanks for solving bug 36248, total number of pages with empty block
> :ClassCastException in KnuthInlineBox.
> 
> Unfortunately perhaps, I think I have a better idea for handling block
> content in inline content, specifically in InlineLM. 
> 
> For each block Knuth element that InlineLM receives from a BlockLevel
> child LM, it should insert a complete one-line paragraph into its
> return list. This paragraph consists of a KnuthBox, a KnuthGlue with
> infinite stretchability, and a negative infinite penalty.  In this way
> InlineLM would hide the block content from the other LMs, which is
> appropriate. This also solves the problem that getNextKnuthElements
> does not really return the same type of object for BlockLevel and
> InlineLevel LMs.
> 
> It allows us almost to go back to the old code in LineLM. The only
> difference is that the return list may contain multiple paragraphs,
> whose end is signalled by a negative infinite penalty. Even this is
> not really necessary, but I think it is more efficient than returning
> to LineLM at the end of each paragraph.
> 
> I have not investigated how InlineLM would do the conversion from
> block elements to a paragraph and back, but I do not see a huge
> problem there.
> 
> If no one else does it before me, I will try to work out this idea,
> but not until several weeks from now.
> 
> Sorry for not thinking of this rather obvious solution earlier. It
> would have saved some work.



Jeremias Maerki