Documentation
OpenType Fonts
If asked what type of fonts are best for ePubs the answer is OpenType because OpenType fonts have many advantages over previous font formats such as they contain more glyphs, support more languages (OpenType uses the Unicode standard for character encoding), and support rich typographic features such as small caps, old style figures, and ligatures — all in a single font.
If you need a font from UTC most OpenType fonts are stored under the OpenType 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.
If an OpenType font cannot be found it may have:
- have access restrictions
- be under a department for example some fonts are only licensed to B&H Academic so check under the section B&H Academic
CSS
Any font added to the font
directory should be referenced in the CSS, example:
css1@font-face {2font-family: 'Adobe Garamond Pro';3font-style: normal;4font-weight: normal;5src: url('../font/AGaramondPro-Regular.otf');6}
by default the format is not included and should be added, regex:
bash1## Find:2(?<=\.otf"\));$34## Replace:5format('opentype');
If a font comes in italic it should be coded with a font style of italic
and oblique
, example:
css1@font-face {2font-family: 'Adobe Garamond Pro';3font-style: italic;4font-weight: normal;5src: url('../font/AGaramondPro-Italic.otf') format('opentype');6}7@font-face {8font-family: 'Adobe Garamond Pro';9font-style: oblique;10font-weight: normal;11src: url('../font/AGaramondPro-Italic.otf') format('opentype');12}
OPF
All OpenType fonts have to be included in the OPF Manifest, example:
html1<item2id="AGaramondPro-Italic.otf"3href="font/AGaramondPro-Italic.otf"4media-type="application/vnd.ms-opentype"5/>6<item7id="AGaramondPro-Regular.otf"8href="font/AGaramondPro-Regular.otf"9media-type="application/vnd.ms-opentype"10/>
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.