View Single Post
Old 06-22-2022, 07:03 PM   #5
mazdaspeed
Member
mazdaspeed began at the beginning.
 
Posts: 16
Karma: 10
Join Date: May 2018
Device: calibre
So, here's a follow-up on this matter after a couple weeks of intense troubleshooting.

Many of the eBooks I publish are 500 pages and up, and with our organization's standard promotional pages and their associated images, I can easily approach an EPUB file size of 2Mb if the font files don't subset into reasonable sizes. For this reason, Adobe Fonts are preferable because InDesign subsets them into quite small file sizes of about 25Kb-35Kb. I do understand that Calibre will subset fonts, but not this efficiently.

InDesign both embeds and subsets the fonts when it exports to EPUB, and what I've learned over the past couple of weeks is that InDesign often creates paragraph and character spans that are dual purpose in nature, and may apply 2 span attributes to a single span when styling a portion of text (forgive me if my html/CSS nomenclature is less than perfect).

As such, you can get something like the following in your CSS output, where a span uses a combination of two span declarations. Here's an excerpt of some actual html/CSS from a promotional page, where my character style, "BoldCharaRPI" could be combined with two or more different font faces, sizes, etc:
Spoiler:

<p class="pSerifNoIndent">While we were distributing <span class="BoldCharaRPI _idGenCharOverride-10">Rising Press International</span> publications.</p>

span.BoldCharaAcrosticEPUB {
font-style:normal;
font-weight:bold;
}
span.BoldCharaEPUB {
font-style:normal;
font-weight:bold;
}
span.BoldItalicCharaEPUB {
font-style:italic;
font-weight:bold;
}
span.FtntRefNumEPUB {
font-style:normal;
font-weight:bold;
vertical-align:super;
}
span.ItalicCharaMyriadEPUB {
font-style:italic;
font-weight:normal;
}
span.ItalicCharaScriptEPUB {
font-family:"Kepler Std Medium", serif;
font-style:italic;
font-weight:500;
}
span.ItalicLightCharaEPUB {
font-style:italic;
font-weight:normal;
}
span.ScriptVerseNumEPUB {
font-family:"Kepler Std Light", serif;
font-size:0.75em;
font-style:normal;
font-weight:600;
}
span.ScrptBlckVrsRefEPUB {
font-style:normal;
font-weight:normal;
}
span.SemiboldCharaEPUB {
font-style:normal;
font-weight:bold;
}
span.SemiboldItalicEPUB {
font-style:italic;
font-weight:bold;
}
span.BoldCharaRPI {
font-style:normal;
font-weight:bold;
}
span.BoldItalicCharaRPI {
font-style:italic;
font-weight:bold;
}
span.ItalicCharaMediumRPI {
font-style:italic;
font-weight:normal;
}
span.SemiboldCharaRPI {
font-style:normal;
font-weight:bold;
}
span._idGenCharOverride-1 {
font-family:"Myriad Pro Light";
}
span._idGenCharOverride-2 {
font-family:"Kepler Std Light";
}
span._idGenCharOverride-3 {
font-family:"Kepler Std Medium";
}
span._idGenCharOverride-4 {
font-family:"Kepler Std Light";
font-size:58%;
}
span._idGenCharOverride-5 {
font-size:0.818em;
}
span._idGenCharOverride-6 {
font-family:"Kepler Std";
}
span._idGenCharOverride-7 {
font-family:"Myriad Pro Light";
font-size:58%;
}
span._idGenCharOverride-8 {
font-family:"Minion Pro SmBd";
font-size:58%;
}
span._idGenCharOverride-9 {
font-family:"Minion Pro Med";
}
span._idGenCharOverride-10 {
font-family:"Minion Pro";
}
span._idGenCharOverride-11 {
font-family:"Adobe Caslon Pro";
}

The above CSS example might be excessive to make my point, but it's the actual number of spans generated in my most recent publication. I always rename the _idGenCharaOverride-NN to something that makes sense to me, but I left them here for the example of actual InDesign output for a single book.

Back when I was not defining my eBook fonts, and simply used serif and sans-serif font families, I would rename and/or remove most of the "_idGenCharOverride-NN" from my markup, keeping only what was necessary for Bold, Italic, BoldItalic, etc.

However, this cannot be the case when using subset fonts exported by InDesign, because InDesign calculates every iteration of a font applied to the text in your working document, and subsets the font file to only the necessary characters within it. As such, don't expect to be able to swipe a subset Adobe font from one EPUB and use it in another, as it likely will give you problems like the one I pictured in my initial post.

I'm now getting Kindle to process attributes such as: "font-weight: 500" for a semibold font, assuming it's applied to a subset font that uses the 500 weight. If I don't have the applicable font file embedded, then it won't work. However, after 2 weeks of hair-pulling I just successfully published a KDP book using 11 iterations of 3 font faces.

Adobe fonts work perfectly, when utilized perfectly. There are no shortcuts.

Now, many will ask, why are you specifying fonts, anyway? The answer is that I'm creating a Brand. I really don't care what font the end user chooses to read the book with, but I do care what the book looks like the first time the book is opened -- namely, just like the paperback. I would also like to think I'm choosing fonts that are pleasing to read, but that's an expectation beyond this scope.

I know someone said, "don't use InDesign for EPUBs," but I'm not going to throw my work out after creating the paperback. That just doesn't make sense. Besides, Adobe has made leaps and bounds with EPUB export, since 2020. I highly recommend it.

With that said, and with my latest EPUB published using Calibre as a finishing tool, it's time to make another contribution to the Calibre project. Keep up the good work, David!

Last edited by theducks; 06-22-2022 at 07:19 PM. Reason: spoilered
mazdaspeed is offline   Reply With Quote