FriendsOfEpub/Blitz

Why specify a fixed line height of 1.2 in typo.less?

ptmkenny opened this issue · 1 comments

In typo.less, a line height of 1.2 is specified four times.

For example:

h2, .h2 {
  .rhythm(2, 2, 1);
  .rhythm(3, 0, 1);

  @media @kf8 {
    line-height: 1.2;     /* Minimum value Kindle supports */
  }

Why is this being done?

There is a body-line-height variable that is easy to change, but these values are unrelated to the value of that variable.

Japanese documents tend to have a line-height of 1.75, so I'm thinking that these line-heights should probably be increased as well-- either by adding a variable or by computing them to be based on the body-line-height. But maybe I am misunderstanding why this is being set here, so please let me know.

That was a long-standing limitation in the Kindle Publishing Guidelines i.e. if the value was < 1.2 (or 120%), then it would corrupt their pagination and, if I’m not mistaken, they even started removing it at some point because of that, so you would end up with the default line-height of 1.75.

I quite frankly wasn’t really willing to handle this edge case in the rhythm() mixin, especially as Kindle was another optional stylesheet for years so the idea was that people would customise it anyway.

Another part of the laziness is that conditions in LESS a.k.a. “Mixin Guards” are super weird – even weirder now that my daily job is 100% JavaScript – so I never really bothered refactoring rhythm.less to improve it a little bit, which would have been an opportunity to include this exception.