Font names alone may not be sufficient. Most readers will only support a handful of default fonts and if you want users to be able to use other fonts as well, you need to embed those fonts in your epub. This will require you to add the fonts as baggage files and modify the CSS to load the required fonts. See http://blog.threepress.org/2009/09/16/how-to-embed-fonts-in-epub-files/ for more information on embedding fonts.
Thank you, William. Your reply was correct, and I was able to make it work.
Here is some additional information, in case anyone has a similar problem in the future.
First, the actual font files (.ttf or .otf) must be added to the Baggage Files directory. In addition, it’s necessary to include a statement like this in the .css file:
After I did that, I was usually able to see the fonts I wanted in the eBook.
Note, however, that it is hard to get consistent results. I tried four or five different eBook readers, and the file is rendered differently in every one. Some readers do a pretty good job, and some do not. I don’t think that's a RoboHelp problem, or even an Adobe problem. The EPUB format seems to be very limiting, and the variation between readers is very great.
Glad it's working. To expand on your last remark: Not all epub readers support custom fonts. So you can't rely on the font being used. Always specify a 'backup font' in the css that is universal. Example:
font-family: Tahoma, Arial;
Thanks for this information. It was helpful for getting monospace fonts to work properly in ibooks. One item of note, however: although adding the fonts as baggage files did result in the content.opf file to get updated (to include a line for the font), an error is generated in the epub validation.
ERROR: C:/test_project.epub/OEBPS/content.opf(31,60): element "item" missing required attribute "media-type"
I believe this is because the line in the opf added is like so:
<item id="resource_1" href="texgyrecursor-regular.otf" />
and according to some research I did, I think it should be like so:
<item id="resource_1" href="texgyrecursor-regular.otf" media-type="font/opentype"/>
Any way around this? It's a huge hurdle to unzip, modify the opf, rezip files when our plan is to create dozens of epub files for our technical pubs the way we do for PDFs... (ie, the extra steps will really slow things down)
Message was edited by: SueC2009
Also, I wanted to mention: although embedding the font allowed paragraphs defined with the font to work properly in ibooks, character formatting using the same font did not work. I had to also perform the following to make the character formatting work. I think this is in an issue in ibooks only. It worked nicely on an Android device. I wanted to add this information in case it is helpful for others:
1. Create a file named: com.apple.ibooks.display-options.xml, which includes the following lines:
<?xml version="1.0" encoding="UTF-8"?>
2. After creating your epub file, change the .epub file extension to .zip and unzip the file.
3. Copy the com.apple.ibooks.display-options.xml file into the META-INF folder of the epub file structure.
4. Open the content.opf file and declare the com.apple.ibooks.display-options.xml file, like so:
<item href="/META-INF/com.apple.ibooks.display-options.xml" id="caido" media-type="application/xhtml+xml"/>
5. Use a utility, such as ePubPack (it's free) to compress the files into an epub. You should use a utility, because simply rezipping the epub files and changing the extension back to epub may not work (some files in the epub need to remain uncompressed).
It would be nice if Robohelp did this automatically. Apparently InDesign does this automatically (that's what I read on a blog posting, but I can't confirm that since I don't use InDesign).
Message was edited by: SueC2009
How are you creating EPUB files? Are you on RH10 using the SSL, or are you using the script?
I am using the SSL on RH10.
In this case, if you want RoboHelp to automatically add this information to the EPUB, Adobe must build it. Please file a feature request for that.
Thanks, that's a good idea, I will do that.
I just wanted to add the information here in case it is helpful for others, as this is not a Robohelp-specific problem. In trying to find a solution for this, I found many posts online from people who had the same issue (using various tools).
It's more of a problem specific to ibooks, and it crops up a lot for those trying use use monospaced fonts in technical documents in particular as these fonts are used in code blocks...
One note, I looked into the ebook SSL and it seems you can change its behaviour. In the RoboHelp HTML folder there is an Ebook folder. This folder holds severl XML files that control the output. Perhaps you can sneak your custom file in there and let RH publish the output.
It may not work, but it's worth a try If you can share a small example project with a correct XML, I can also take a look.