DocBook to EPUB Transformation

The EPUB specification recommends the use of OpenType fonts (recognized by their .otf file extension) when possible. To use a specific font, follow these steps:

  1. Declare it in your CSS file, as in the following example:
    @font-face {
    font-family: "MyFont";
    font-weight: bold;
    font-style: normal;
    src: url(fonts/MyFont.otf);
    }
  2. In the CSS, specify where this font is used. To set it as default for h1 elements, use the font-family rule, as in the following example:
    h1 {
    font-size:20pt;
    margin-bottom:20px;
    font-weight: bold;
    font-family: "MyFont";
    text-align: center;
    }
  3. Open the Configure Transformation Scenario(s) dialog box, select the DocBook EPUB transformation scenario, and click Edit.
  4. In the Parameters tab, set the epub.embedded.fonts parameter to fonts/MyFont.otf. If you need to provide more files, use commas to separate their file paths.

    Note

    The html.stylesheet parameter allows you to include a custom CSS in the output EPUB.
  5. Run the transformation scenario.

Was this helpful?