← Back to team overview

calibre-devs team mailing list archive

EPUB font embedding

 

Kovid etc,

I took a look at the matplotlib FontManager documentation and it does
look really neat -- definitely much more complete and flexible than the
partial fontconfig wrapper calibre has now.  Any idea how intertwingled
it is with matplotlib?  Calibre's dependency list is getting pretty
large as it is...

I've been trying to think about the use-cases for font embedding, and I
think there are four which cover it:

  1. Book generation / design. The book designer specifies a set of
     families (and possibly @font-face rules defining them) using fonts
     present on their system.
  2. Book conversion w/ embedded fonts. The source book contains
     embedded fonts which need to be re-embedded in the output.
  3. Web content conversion.  The source CSS will specify font families
     which may or may not be present.
  4. Content conversion w/ user font override.  The user will specify
     fonts present on their system to use, possibly instead of fonts
     specified by content itself.

In cases 1, 2, and 3 the fonts are specified in-band.  Calibre just
needs to interpret the 'font' properties and '@font-face' rules, find
appropriate font files, and generate appropriate '@font-face' rules for
them.  I think the only tricky bit is what to do in cases (probably
mostly 3) where it can't find an appropriately close font.

For case 4, I think any sort of comprehensive interface for out-of-band
control of font embedding would be difficult to make usable.  I think
the simplest thing which could possibly work would be to allow the user
to specify just font families for the CSS generic font families and
reduce all 'font-family' properties to just one of that set.  Tricky
bit: is it too confusing to make the user specify a sans-serif font for
'serif' if they want to force sans-serif fonts everywhere?

-Marshall



Follow ups