Having a Problem with Pressbooks Custom CSS Fonts? Here’s How to Fix It!

If you are using Pressbooks Custom CSS as your Theme (which allows you to edit the design of your book), you might have noticed that your PDF (and possibly your EPUB) fonts have changed.

This is a result of a big change we made in how we generate our CSS files in the backend of Pressbooks, and moving the fonts from where they were … to somewhere else. In the long run, this will make Pressbooks much more flexible. In the short run, if you are using Custom CSS it might cause problems with fonts.

Here’s how to fix bad fonts in Custom CSS!

If you look at your Custom CSS editor (PDF version), you will find your fonts, listed something like this:


@font-face {
  font-family: "Cardo";
  font-weight: bold;
  font-style: normal;
  src: url(http://yourbookname.pressbooks.com/wp-content/themes/kolbert/export/prince/../../fonts/Cardob101.ttf) format("truetype");
}

@font-face {
  font-family: "Cardo";
  font-weight: normal;
  font-style: italic;
  src: url(http://yourbookname.pressbooks.com/wp-content/themes/kolbert/export/prince/../../fonts/Cardoi99.ttf) format("truetype");
}

The paths for all such fonts in your Custom CSS need to be edited/replaced as follows:

@font-face {
  font-family: "Cardo";
  font-weight: bold;
  font-style: normal;
src: url(themes-book/pressbooks-book/fonts/Cardob101.ttf) format("truetype");
}

@font-face {
  font-family: "Cardo";
  font-weight: normal;
  font-style: italic;
  src: url(themes-book/pressbooks-book/fonts/Cardoi99.ttf) format("truetype");
}
Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *