Re: Properties of Custom Layout

On Mon, 2015-06-01 at 14:00 +1000, Ian Kilpatrick wrote:
> Hi all,
> 
> Similar to Custom Paint, we wanted to start some more discussions on 
> the mailing list around Custom Layout. Shane & I sat down what we 
> think are some of the desirable properties.
> 
> See https://gist.github.com/bfgeek/93408fe4182d87e92b7b

It's a good start. A tricky aspect to resolve that I didn't see 
explicitly mentioned was pagination/fragmentation - custom layout code 
should be able to
* change the size of a single page (insert bigger paper)
* change the size of the balancing pages on a double-page spread 
(usually this is done to add one or two extra lines of text; some 
publishers will add one line on the preceding and folowing spread if 
it's two, to make it less noticeable)
* move items to the previous or next page
* insert explicit column breaks (start a new column)
* insert breaks in a footnote (to be continued on the next page)
* select alternate content (e.g. a shorter running title,
  already marked up in the document) if the content doesn't
  fit in the space
* change link text for cross references to say "overleaf" or
  "see opposite" or "this page, above" etc. instead of "see page 391"
  I mention this one because the changed size of cross-references
  more often than one would expect necessitates reformatting some
  or all of the document

It may make sense to provide JavaScript control over the layout order -
- you may want access to the listof children (yes, it's blocking when 
you do this) before starting any layout -- "if any figure on this page 
is tall, put it in the margin and reduce the available width for 
paragraphs; if that causes the reference to the figure to be on the 
next page, try again with increased minimum word spacing and less 
hyphenation; if that fails... etc etc.

Making "calculate-size-of-child-boxes() and create-fragments()" part of
the API may mean they could be called more than once as needed. E.g. I 
can imagine a "layout-self" property on a node being used whenever 
layout-children() is called, whether internally or from javascript.


> <
> https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fbfgeek%2F93408fe4182d87e92b7b&sa=D&sntz=1&usg=AFQjCNGjov9R3QzZqzOuolRqt1BYSkANmQ>
> 
> Again feel free to respond here, or directly on the gist.
> 
> Thanks, Ian

Received on Wednesday, 3 June 2015 18:06:19 UTC