← Back to team overview

calibre-devs team mailing list archive

Font-sizes

 

Hi all / Kovid:

So I'm trying to create a more robust system for rationalizing
CSS-specified font sizes, including the "key" based system I described
in an earlier thread.  There are three main causes of headaches:

  (1) Different display engines have different base font-sizes for text
      which doesn't have a 'font-size' specified in its inheritance
      chain.
  (2) Different display engines map the CSS logical font sizes
      ('xx-small', 'x-small', etc.) to different actual sizes.
  (3) Different display engines vary their base and logical sizes
      differently in response to user-selected zoom levels.

Here's a table showing logical font sizes for various readers at various
zoom levels (The data are formatted: <base size>, [<xx-small size>,
<x-small size>, <medium size>, etc.])

  Sony Reader / Adobe DE
  small:     9.0, [ 5.5,  6.0,  7.5,  9.0, 11.5, 15.0, 15.0]
  medium:   12.0, [ 7.5,  9.0, 10.0, 12.0, 15.5, 20.0, 20.0]
  large:    16.0, [10.0, 11.0, 13.5, 16.0, 21.0, 26.0, 26.0]
  * The initial zoom in the desktop version of Adobe DE corresponds to
    "large" on the Reader.

  MSReader
  smallest: 11.0, [ 7.0, 10.0, 11.0, 13.0, 16.0, 18.0, 20.0]
  small:    13.0, [10.0, 11.0, 13.0, 16.0, 18.0, 20.0, 22.0]
  medium:   14.0, [11.0, 13.0, 14.0, 16.0, 18.0, 22.0, 26.0]
  large:    16.0, [13.0, 15.0, 16.0, 18.0, 22.0, 26.0, 28.0]
  largest:  18.0, [14.0, 16.0, 18.0, 22.0, 26.0, 28.0, 30.0]

  Firefox 3 / Gecko
  100%:     12.0, [ 5.0,  7.0,  9.0, 12.0, 13.5, 17.0, 17.0]
  * Gecko appears to scale even fixed-sized fonts with zoom level,
    although by a factor not in lock-step with the logical sizes.

  ebook-viewer / WebKit
  default:  14.5, [ 9.5, 11.0, 13.5, 14.5, 18.5, 23.0, 23.0]
  * WebKit also appears to scale even fixed-sized fonts with zoom level,
    and again not in lock-step with the logical sizes.

I haven't profiled Mobipocket yet, although IIRC it only supports the
HTML 4.0 <font size="[1-7]/> format, which will make doing so annoying
at the very least.

Anyway, what I'm getting at is that to convert font sizes properly, a
conversion/generation process needs to be aware of the logical sizes of
both the source and destination formats/viewers.  This is especially
true when the source content uses the viewer-provided base font size or
mixes any of base-derived font-sizes, logical font-sizes, or fixed
font-sizes (all of which I have alas seen in commercial LIT e-books).

A secondary problem is which zoom-level to target.  When during
conversion targeting one of the viewers which do not vary the size of
fixed-sized fonts with zoom-level, in order to make the resulting book
zoomable, it is necessary to use the logical font sizes as a base /
bases in some fashion.  This means picking a zoom-level to target as the
"default" at which the fonts will be as close to the source /
user-specified sizes as possible.

</babbling>, thoughts?

-Marshall



Follow ups