The EPUB specification recommends the use of
OpenType fonts (recognized by their
.otf
file extension) when possible. To use a specific font:
- first you need to declare it in your CSS file,
like:
@font-face {
font-family: "MyFont";
font-weight: bold;
font-style: normal;
src: url(fonts/MyFont.otf);
}
- tell the CSS 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
comma to separate their file paths.