File last modified on August 18, 2022

TrueType

There have been rumors and discussions that w3c will no longer suggest or allow TrueType fonts in ePubs. At the moment this isn't an issue and doesn't fail validation so we will continue to allow TrueType fonts.

If you need a font from UTC most TrueType fonts are stored under the Speciality/TT/Web/Epub directory. You can drag and drop a font on your Desktop but you will get an error if a font is dragged with My Fonts highlighted.

CSS

Any font added to the font directory should be referenced in the CSS, example:

css
1
@font-face {
2
font-family: 'Gentium';
3
font-style: normal;
4
font-weight: normal;
5
src: url('../font/Gentium.ttf') format('truetype');
6
}

by default the format is not included and should be added, regex:

bash
1
## Find:
2
(?<=\.ttf"\));$
3
4
## Replace:
5
format('truetype');

If a font comes in italic it should be coded with a font style of italic and oblique, example:

css
1
@font-face {
2
font-family: 'Gentium';
3
font-style: italic;
4
font-weight: normal;
5
src: url('../font/Gentium-Italic.ttf') format('truetype');
6
}
7
@font-face {
8
font-family: 'Gentium';
9
font-style: oblique;
10
font-weight: normal;
11
src: url('../font/AGaramondPro-Italic.otf') format('opentype');
12
}

OPF

All TrueType fonts have to be included in the OPF Manifest, example:

html
1
<item id="GentiumPlus.ttf" href="font/GentiumPlus.ttf" media-type="application/x-font-ttf" />

Order in which doesn't matter but order scripted from the app OPF Builder reads the font directory with a top down approach.

If a font has whitespace in the name it's likely the font wasn't from UTC. If this is the case the font should be pulled from UTC and the file replaced. By default OPF builder will pull any font located in the font directory even if the name has whitespace and if this is added when you go to validate it will fail validation.

ON THIS PAGE
Last build: Thursday, 08/18/2022, 01:01:08 AM