Edit-book: Incorrect reporting and fixing mismatched font-family name

Bug #1596053 reported by Robert Błaut on 2016-06-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Consider following code:

@font-face {
 font-family: Liberation Serif Sans;
 font-style: normal;
 font-weight: normal;
 src: url(../Fonts/LiberationSerif-Regular.otf);

According CSS standard the definition of font family is perfectly valid. Check this article: https://mathiasbynens.be/notes/unquoted-font-family

Actually edit-book reports completely false warning:

Warning [6 / 11]
OEBPS/Styles/woblink.css
The font family name specified in the CSS @font-face rule: "Liberation" does not match the font name inside the actual font file: "Liberation Serif". This can cause problems in some viewers. You should change the CSS font name to match the actual font name.
Change the font name Liberation to Liberation Serif everywhere

If you click proposed action: "Change the font name Liberation to Liberation Serif everywhere" you will get following completely faulty result:

@font-face {
  font-family: "Liberation Serif" Serif Sans;
  font-style: normal;
  font-weight: normal;
  src: url(../Fonts/LiberationSerif-Regular.otf);

Technically, sure. But, using font family names like that will break in
lots of places, because lots of places require spaces to be quoted
(including various CSS validators). So just dont do that.

In any case the bug is in the cssutils package, not in calibre.
https://bitbucket.org/cthedot/cssutils/issues/66/incorrect-handling-of-spaces-in-font

I will look into adding a workaround for the cssutils bug to calibre, when I have
some time.

Robert Błaut (1-robert) wrote :

The workaround will be great.

I hope you understand that edit-book is not always used by publishers but also by more technical advanced ebook owners. I often buy books from various sources and using ebook-edit I tweak the bought books for my needs. Publishers often make awful errors, so with ebook-edit I always check and repair various errors. With the reported problem I am unable to trust this particular edit-book fix.

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers