User:Rfrank
Using embedded fonts in submissions to PG
Some characters used by Post-processors look great in HTML, but the glyphs to display them are missing from EPUB readers. An example is the two-em dash. To get the glyph to display, either the end user or the Post-processor has to load a font that includes it. It’s unrealistic to expect the end-user to find and install a font. They just want to read the book.
Post processors can include an embedded font that has the two-em dash character in their HTML upload . Here is a walk-through using `NotoSans-Regular.ttf`.
Start by downloading the font from `https://fonts.google.com/noto`
A PPer will already have an ‘images’ folder in their “-h” HTML folder. Now add a subfolder called “fonts” and put the NotoSans-Regular.ttf file in the ‘fonts’ folder. That’s the first step to make HTML aware of it.
In the CSS, have this reference to the font:
@font-face { font-family: 'NotoSans'; src: url('fonts/NotoSans-Regular.ttf') format('truetype'); font-weight: normal; font-style: normal; }
For this example, it’s the two-em dash that we want to display in the new font. Include this also in the CSS:
.two-em-dash { font-family: 'NotoSans', serif; }
Now, anytime you want a two-em dash in HTML, specify it like this:
<p>Now, I reckon yuh had to come clear up here to tell me that th’ grub is on th’ table, eh? Of all th’ gol dinged<span class="two-em-dash">⸺</span>”</p>
You can see this in use in this book: https://www.gutenberg.org/ebooks/76171
Notes:
- I know the Kobo Clara HD accepts .ttf fonts but not .woff. I don’t know about other ereaders. It’s possible that they expect .woff fonts.
- Make sure it is legal to use whatever font you embed. The source of the font and the legal status should be specified in the upload note when submitting to PG.
- Including an entire font just to get one glyph seems wasteful of ereader memory.
- Currently, this only works for EPUB3 since Ebookmaker replaces a two-em dash with a single mdash when making an EPUB2.