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:
- 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);
}
- 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;
}
- In your DocBook to EPUB transformation, set the epub.embedded.fonts
parameter to fonts/MyFont.otf. If you need to provide more files, use
commas to separate their file paths.