• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Fonts in EPUB files

New Here ,
Jan 10, 2013 Jan 10, 2013

Copy link to clipboard

Copied

When I generate output as an eBook, the results do not use the correct fonts.  I assume I need to embed the fonts somehow, but I have not been able to find a way to do this. 

The font names are listed in the .css file, so I don't think that's the problem.

I'm using RoboHelp 10, and using EPUB3 as the eBook format.

TOPICS
Classic

Views

10.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 12, 2013 Jan 12, 2013

Hi,

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.

Greet,

Willam

Votes

Translate

Translate
LEGEND ,
Jan 12, 2013 Jan 12, 2013

Copy link to clipboard

Copied

Hi,

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.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2013 Jan 17, 2013

Copy link to clipboard

Copied

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:

@font-face {

                font-family: Tahoma;

                font-weight: normal;

                font-style: normal;

                src: url(Tahoma.otf);

}

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2013 Jan 17, 2013

Copy link to clipboard

Copied

Hi,

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:

p {

font-family: Tahoma, Arial;

}

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 19, 2013 Sep 19, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 19, 2013 Sep 19, 2013

Copy link to clipboard

Copied

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"?>

<display_options>

<platform name="*">

<option name="specified-fonts">true</option>

</platform>

</display_options>

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

How are you creating EPUB files? Are you on RH10 using the SSL, or are you using the script?

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

Hi William,

I am using the SSL on RH10.

Sue

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 24, 2013 Sep 24, 2013

Copy link to clipboard

Copied

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.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 24, 2013 Sep 24, 2013

Copy link to clipboard

Copied

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 25, 2013 Sep 25, 2013

Copy link to clipboard

Copied

LATEST

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.

Greet,

Willam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp