View Single Post
Old 03-30-2021, 05:52 PM   #1
GranitStateColin
Member
GranitStateColin began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jul 2017
Device: none
Question Embedded Fonts on DOCX -- Calibre partially fails, any automated fix?

I'm not sure if it's Word's fault or Calibre's, but here's the problem: if you embed a font in Word (only TrueType and OpenType TrueType fonts are embeddable, not PostScript fonts), then save it as a DOCX, then do a DOCX -> EPUB conversion in Calibre, the font name WILL HAVE SPACES (100% of the time), which makes the EPUB unusable through many outlets.

Even if the font name and font file don't have any spaces, Calibre or Word adds spaces, a hyphen, and the word Regular (or Bold, Italic, or BoldItalic) to the end. For example if you have a font named MyFont, and a font file MyFont.ttf, embed and save that, then when you convert that DOCX to EPUB in Calibre, when you look at the resulting EPUB file, the font will end up as "MyFont - Regular.ttf". To be clear, I've even tried using FontLab to convert fonts into new font files specifically to confirm there is nothing in the font name that would cause this.

I had originally thought this was Word's fault (and it still might be), but if you export that same Word document to PDF file, and then in Adobe Reader -> File -> Properties -> Fonts, it will appears as "MyFont-Regular.ttf" (no spaces). So both PDF and EPUB have the word "Regular" added, but only Calibre's conversion seems to add or maintain those extra spaces. So at least in part, this appears to be a Calibre defect for adding (or keeping) the extra spaces.

As some of you know, spaces in a font name will cause EPUB files to be summarily rejected by several EPUB outlets. Apple will almost always reject them. Google and Kobo will frequently reject them (sometimes they slip through).

As a work-around, if you use Calibre's own Edit Book -> Run Check -> it shows the font errors as warnings. If you then use its auto-fix, it fully fixes the problem. HOWEVER, if I'm trying to help non-technical authors or provide them with a Word template to help them create EPUB files, I don't want to tell them they then need to go in and remove theses errors. That's a trivial step for those of us comfortable with the process, but it's a hassle and problem for others. And it's just annoying to get error messages every time.

Is there any other way to either:

1. Avoid ending up with spaces in the font file names in the first place

2. Automate the fix from the Book Editor

3. Any other suggestions?

Thanks,
Colin
GranitStateColin is offline   Reply With Quote