Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 12-22-2018, 09:03 AM   #1
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
EPUB to AZW3: font sizes changed -- AGAIN!

I had a problem earlier with this earlier (see this thread) which turned out to be due to not having checked "Disable font size rescaling" under Look & feel > Fonts.

Since then I have made this the default, and I spent three days reconverting all my EPUBs with "Use saved conversion settings" unchecked, to make sure that I don't get hit by a book which uses some old settings with font size rescaling enabled.

However, I now have another font size rescaling issue. One of my EPUBs (which looks perfectly normal) has <body> tags with no associated CSS. Looking at it with the Calibre editor, the "computed final style" text font size is 18pt (the usual default 1em size), but the converted AZW3 has <body class="calibre">, and the generated "calibre" CSS class contains a line which says "font-size: 12pt". On my Kindle, this is unreadably small, and I have to zoom in to size 11 (on a scale of 1 to 14) before it looks normal, which is size 4 for any other book.

I've looked at all the conversion settings and have tried various things to get rid of this (e.g. specifying a CSS rule for <body> with font-size: 1em in the EPUB), but it keeps insisting on generating an AZW3 with a 12pt font size, and the only way I can get rid of it is to manually edit the AZW3 after converting.

I've only found this one book with this problem so far, but I have no idea how many others might be affected...

Has anyone got any idea why this might be happening?

Last edited by Phssthpok; 12-22-2018 at 09:11 AM.
Phssthpok is offline   Reply With Quote
Old 12-22-2018, 11:52 AM   #2
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
I've just found another example. A chapter heading and subheading use these rules in the original EPUB:
Code:
.h2 {
  font-family: serif;
  text-align: center;
  text-indent: 0;
  margin-top: 3em;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 3em;
  font-weight: normal;
}
.h2a {
  font-family: serif;
  font-size: x-large;
  text-align: center;
  text-indent: 0;
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 2em;
  font-weight: bold;
}
After conversion, what I end up with in the AZW3 is this:
Code:
.h2 {
    display: block;
    font-weight: bold;
    text-align: center;
    text-indent: 0;
    margin: 2em 0 1em
    }
.h2a {
    display: block;
    font-family: serif;
    font-size: 17pt;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    text-indent: 0;
    margin: 0 0 2em
    }
So the main heading (<h2 class="h2">) ends up with the default H2 font size, but the subheading is reduced to 17pt, which looks tiny on my Kindle (about 50% of the size of the text in the chapter). In the Calibre editor, it looks quite normal: 17pt = 23px. The chapter text is 1em = 18px.

The margins are also changed in the main heading from 3em top and bottom to 2em top and 1em bottom.

It seems that all font sizes are being expressed in points, and 1em is being treated as equivalent to 12pt, and Kindle points are nothing like 1/72in. And it's also got its own ideas about what margins I should be allowed to have.

Last edited by Phssthpok; 12-22-2018 at 12:01 PM.
Phssthpok is offline   Reply With Quote
Advert
Old 12-22-2018, 12:11 PM   #3
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
As a sanity check, I converted again but with font size scaling enabled. (I disabled it earlier because my chapter headings were being shrunk). Suddenly all the generated font-size rules are expressed in ems instead of points, and it looks sensible again.

So it would seem that there is no way to get the font sizes in the EPUB accurately translated to the AZW3 -- either I end up with sizes in ems translated into incorrect sizes in points, or I let it change font sizes in ems into different font sizes in ems. Apart from which, it also changes my margins, whether I use font size rescaling or not.

It looks like I'll have to go for font rescaling, and waste another three days reconverting everything, unless someone can suggest an alternative...

Last edited by Phssthpok; 12-22-2018 at 12:20 PM.
Phssthpok is offline   Reply With Quote
Old 12-22-2018, 12:29 PM   #4
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
As a sanity check, I converted again but with font size scaling enabled. ... Suddenly all the generated font-size rules are expressed in ems instead of points, and it looks sensible again.
My work flow is much like yours, so I have been following and trying to understand the issues you have brought up in two threads. I edit in ePub and then convert to AZW3 for reading.

I always have "Disable Font Size Rescaling" checked in my Calibre "Common Options" dialog. The font sizes always emerge as em units--never pts or anything else. There may be some other issue at work here.
Brett Merkey is offline   Reply With Quote
Old 12-22-2018, 01:57 PM   #5
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Brett Merkey View Post
My work flow is much like yours, so I have been following and trying to understand the issues you have brought up in two threads. I edit in ePub and then convert to AZW3 for reading.

I always have "Disable Font Size Rescaling" checked in my Calibre "Common Options" dialog. The font sizes always emerge as em units--never pts or anything else. There may be some other issue at work here.
Hmm, interesting. Do your margins stay the same size too?

As a kindness, could you please try creating a couple of <h2>s using the EPUB CSS I posted above and convert it, and see whether the resulting CSS comes out anything like mine?
Phssthpok is offline   Reply With Quote
Advert
Old 12-22-2018, 03:35 PM   #6
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
As a kindness, could you please try creating a couple of <h2>s using the EPUB CSS I posted above and convert it, and see whether the resulting CSS comes out anything like mine?
I did that and your snippet "font-size: x-large;" got converted to 17pt (!!!)

That is unexpected behavior to say the least. CSS keywords are meant to be translated at the user agent level, not in the stylesheet.

[This brings up a related issue: I have found that the Kindle PaperWhite does not handle CSS font-size keywords well. If your device font settings are not the default, the Kindle will display fonts at uncomfortably extreme sizes. I have created a Calibre regex-function which maps keywords to ems. I will post this in the Editor section.]

Last edited by Brett Merkey; 12-22-2018 at 04:39 PM.
Brett Merkey is offline   Reply With Quote
Old 12-22-2018, 10:05 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,015
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://www.mobileread.com/forums/sh...d.php?t=186697
kovidgoyal is offline   Reply With Quote
Old 12-23-2018, 01:55 AM   #8
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
a 2 step work around to be going on with
1. calibre epub to epub conversion will replace the font size large, Xx large etc styles with sensible numbers... in Ems
2. then converting that output epub to azw should work well. ( everything i have used this workflow on, then placed on my Kindle PW3 has looked ok

I do step one will all newly added books,. arguably it is overkill but it clears out many glitches and annoyances before I even see them, and the output file CSS is easier to understand than some horrible publisher versions.
It also, with my additional settings, gets rid of any embedded fonts and simplifies font styles, and standardizes justification to what I want for reading fiction
stumped is offline   Reply With Quote
Old 12-23-2018, 04:35 AM   #9
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
@Phssthpok,
If Calibre routinely alters CSS font-size keywords during conversion, this could explain both the readability issues in the conversion result and the fact, as you report, that only some books have the problem.

I did not notice this Calibre behavior before you brought the issue up because I always convert those CSS keywords to ems in the epub *before* conversion to AZW3. I recommend avoiding this Calibre issue by using regex to blast away those CSS keywords in the epub. I posted my own workflow solution in the Editor section of this forum. This will allow you to maintain a more fluid control of typography. The translation of keywords to point units for a screen medium does not make much sense and should be avoided.

Last edited by Brett Merkey; 12-23-2018 at 04:39 AM.
Brett Merkey is offline   Reply With Quote
Old 12-23-2018, 07:07 AM   #10
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by kovidgoyal View Post
"It is particularly important that you provide us with a way to reproduce your problem."

Done that, and problem was reproduced by Brett (to whom my thanks).

Last edited by Phssthpok; 12-23-2018 at 07:14 AM.
Phssthpok is offline   Reply With Quote
Old 12-23-2018, 07:09 AM   #11
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by stumped View Post
a 2 step work around to be going on with
1. calibre epub to epub conversion will replace the font size large, Xx large etc styles with sensible numbers... in Ems
2. then converting that output epub to azw should work well. ( everything i have used this workflow on, then placed on my Kindle PW3 has looked ok

I do step one will all newly added books,. arguably it is overkill but it clears out many glitches and annoyances before I even see them, and the output file CSS is easier to understand than some horrible publisher versions.
It also, with my additional settings, gets rid of any embedded fonts and simplifies font styles, and standardizes justification to what I want for reading fiction
I think I'll do the same from now on.
Phssthpok is offline   Reply With Quote
Old 12-23-2018, 07:13 AM   #12
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Brett Merkey View Post
I did that and your snippet "font-size: x-large;" got converted to 17pt (!!!)

That is unexpected behavior to say the least. CSS keywords are meant to be translated at the user agent level, not in the stylesheet.
Thanks for verifying that this is something generic, not something specific to my setup.

I'm intrigued by the fact that it outputs ems with font rescaling turned on -- I presume the rescalingis done in ems, even though the rescaly wizard is in points.

And I still don't like the way it decides that it doesn't approve of my margin settings and changes them.
Phssthpok is offline   Reply With Quote
Old 12-23-2018, 07:45 AM   #13
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
@Phssthpok,
Quote:
doesn't approve of my margin settings and changes them
When user agents (browsers; e-readers) deal with pts units, they seem to translate pts to absolute units--pixels. The results can be bizarre. A 150-px top margin for a 300dpi PaperWhite is 1\2 of an inch on the screen. For a 150dpi Samsung tablet, that translates to a full inch. Perhaps an unwanted difference.

Relative units like ems and %, in the long run, offer better solutions for screen devices.

Last edited by Brett Merkey; 12-23-2018 at 07:50 AM.
Brett Merkey is offline   Reply With Quote
Old 12-24-2018, 08:38 AM   #14
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 559
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Brett Merkey View Post
@Phssthpok,


When user agents (browsers; e-readers) deal with pts units, they seem to translate pts to absolute units--pixels. The results can be bizarre. A 150-px top margin for a 300dpi PaperWhite is 1\2 of an inch on the screen. For a 150dpi Samsung tablet, that translates to a full inch. Perhaps an unwanted difference.

Relative units like ems and %, in the long run, offer better solutions for screen devices.
Except my margins were in ems -- 3em top, 3em bottom, if you look above -- and these were translated into 2em top, 1em bottom. I could perhaps understand it if I started off in points (but I would still expect the top and bottom margins to come out the same size), but I don't understand why it takes it on itself to make arbitrary changes to my preferred settings.
Phssthpok is offline   Reply With Quote
Old 12-24-2018, 09:55 AM   #15
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
I don't understand why it takes it on itself to make arbitrary changes to my preferred settings
My conversion with your code respected your original values. No changes in the margins. Sorry I did not clarify that before. I was so shocked by the 17pt business! Remember also that I always have "font rescaling" turned off. In fact, over time, I have turned off any Calibre features I possibly can that contradict my desire to have full control over my code.

Last edited by Brett Merkey; 12-24-2018 at 10:01 AM.
Brett Merkey is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EPUB to AZW3: font sizes changed Phssthpok Conversion 3 11-29-2018 11:42 AM
KV font sizes ladykayaker Amazon Kindle 13 04-04-2017 11:03 PM
Font size changes when using rem (azw3 to epub) patrik Conversion 10 02-18-2017 06:08 PM
Epub->AZW3 --- embedded font display is wonky GrannyGrump Conversion 2 08-25-2015 06:54 AM
Only five font sizes in K2? KlondikeGeoff Amazon Kindle 6 02-25-2009 10:21 PM


All times are GMT -4. The time now is 06:10 AM.


MobileRead.com is a privately owned, operated and funded community.