[css3-linebox] Line Grid Proposal

On 07/03/2011 11:44 PM, Florian Rivoal wrote:
>
> As discussed in the last telcon, I would like to see a written down version
> of Elika's alternative proposal for line grid.

Alright, here's a rough draft, from the minutes. Note there are many details that
need to be worked out.

The 'line-grid' property
------------------------

Name:       line-grid
Value:      <identifier>
Initial:    root
Inherited:  yes
Percentage: computed relative to used 'line-height'
Computed:   as specified

Specifies which line grid the line boxes of this element (if any) will align
to. If there does not already exist a line grid with the specified name, then
this creates a line grid using the font and line layout settings of this element.
The line grid consists of a series of horizontal lines corresponding to all the
baselines (alphabetic, text-top, text-bottom, mathematic, central, hanging, etc.)
positioned where they would fall if the contents of this element consistent
entirely of line boxes filled with text (no sub-elements) using the first available
font. If the element is paginated, the line grid is restarted on each page;
since line boxes cannot be paginated, no page begins with the bottom part of
a line's grid.

As a side effect of the initial value and this definition, the root element
always sets up a line grid, so that line-snap can be used even if the author
has not explicitly chosen a line grid.

The 'line-snap' property
------------------------

Name:       line-snap
Value:      none | <baseline> | bounds
Initial:    none
Inherited:  yes
Computed:   as specified

This property applies to all the lineboxes directly contained by the element
and causes each line box to shift downward (possibly by zero) until the specified
baseline snaps with the matching baseline on the line grid applying to the element.
(The unshifted position would be the position determined by normal line stacking
rules and any new controls defined by css3-linebox.)

If 'bounds' is specified, then two baselines are used to align the line box: the
next text-top baseline is chosen as a top bounds, and the closest text-bottom
baseline below it that is far enough down that the line box can fit between it
and the chosen text-top is chosen as a bottom bounds. The line box is then centered
between the chosen bounds.

Open Issues
-----------

   - Defining a tolerance so that in mixed font situations the line grid can still
     be used to establish a baseline rhythm
   - Snapping the border box to the line grid. This functionality could be specialized
     to the line grid, but I think it's better to look for a generalized snap-to-grid
     feature that could be used with the grids established by the grid module as well
     as the grid established by 'line-grid'
   - Defining an offset for the line grid (could be a second parameter to 'line-grid')
   - Establishing and snapping to a character grid (vertical lines to control horizontal
     placement).

~fantasai

Received on Thursday, 14 July 2011 21:52:38 UTC