Re: line-height limitations

David Hyatt (2011-03-16):

> The biggest layout problem affecting iBooks today is one that occurs at the start of most chapters.

If that’s really the biggest one, CSS is more mature and more ready for e-books than I thought.

> It happens when a larger font is used on a line just to open a chapter, either with a single larger first letter, or with an entire sentence that is capitalized.

If this was the only use case, we should examine it using CSS best practice:

  .chapter>p:first-child::first-words(2) {
    text-transform: uppercase;
  }  
  .chapter>p:first-child::first-letter {
    font-size: xx-large; font-weight: bold;
  }

Assuming the necessary properties are specced and implemented, line height behavior should be special-cased for the selectors used above in the user agent style sheet (substituting the one not existing yet with ‘::first-line’):

  ::first-line, ::first-letter {
    line-box-contain: glyphs;
  }

I also wonder whether it would be helpful to be able to set the line-box/-height in absolute lengths, but using subparts:

  ::first-line {
    text-transform: uppercase;
    line-height-ascender: 24px;/* or ‘auto’ */
    line-height-descender: 0;
    line-height-accent: 0;
  }  

Uppercasing text with the ‘text-transform’ property and other stylings that remove descenders, such as ‘small-caps’, could even automatically influence such settings.

Received on Thursday, 17 March 2011 09:53:18 UTC