Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-12-2020, 03:55 AM   #1
PapaQuebec
Member
PapaQuebec began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2012
Device: Kindle Oasis 2, Kindle Paperwhite 4,Samsung Tab S,
Homogenise font size

Hi all...

...I'm currently reading a book that has an unusual font structure - the main body of text is in my "normal" font size of about 12pt (level 5 on Kindle) but whole chunks of the text (reminiscences of intervoewees etc) are in a drastically smaller size. These sections can go on for several pages at a time forcing me to "up" the text size to Kidle level 7.

Is there any way I can re-process the book in Calibre to obtain a uniform font size throughout?

Any assistance will be gratefully received!

TIA
PapaQuebec is offline   Reply With Quote
Old 11-12-2020, 05:12 AM   #2
Thasaidon
Hedge Wizard
Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.
 
Thasaidon's Avatar
 
Posts: 802
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
Quote:
Originally Posted by PapaQuebec View Post
Hi all...

...I'm currently reading a book that has an unusual font structure - the main body of text is in my "normal" font size of about 12pt (level 5 on Kindle) but whole chunks of the text (reminiscences of intervoewees etc) are in a drastically smaller size. These sections can go on for several pages at a time forcing me to "up" the text size to Kidle level 7.

Is there any way I can re-process the book in Calibre to obtain a uniform font size throughout?

Any assistance will be gratefully received!

TIA
That is one of the main reasons I completely rework the html and css in my ebooks.

Some of my ebooks also may specify five or more font sizes all slightly different in the CSS (none in sub or superscript) Ranging from 0.91EM to 1.01EM. I do not think multiple font sizes like this makes the ebook look better so I change them all to the standard size.

Last edited by Thasaidon; 11-12-2020 at 05:17 AM.
Thasaidon is offline   Reply With Quote
Advert
Old 11-12-2020, 06:10 AM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by PapaQuebec View Post
Hi all...

...I'm currently reading a book that has an unusual font structure - the main body of text is in my "normal" font size of about 12pt (level 5 on Kindle) but whole chunks of the text (reminiscences of intervoewees etc) are in a drastically smaller size. These sections can go on for several pages at a time forcing me to "up" the text size to Kidle level 7.

Is there any way I can re-process the book in Calibre to obtain a uniform font size throughout?

Any assistance will be gratefully received!

TIA
Use the eBook editor to remove the font size commands that are in CSS.
JSWolf is offline   Reply With Quote
Old 11-12-2020, 07:08 AM   #4
PapaQuebec
Member
PapaQuebec began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2012
Device: Kindle Oasis 2, Kindle Paperwhite 4,Samsung Tab S,
Quote:
Originally Posted by JSWolf View Post
Use the eBook editor to remove the font size commands that are in CSS.
Just remove them?

The CSS specifies two font sizes - 1.125em and 0.75em - I changed them both to 1.125em and that seems to have solved the problem ( well, there's still a miniscule difference but almost imperceptible)
PapaQuebec is offline   Reply With Quote
Old 11-12-2020, 08:26 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by PapaQuebec View Post
Just remove them?

The CSS specifies two font sizes - 1.125em and 0.75em - I changed them both to 1.125em and that seems to have solved the problem ( well, there's still a miniscule difference but almost imperceptible)
If the font size of 1.125em is for the base font size, remove it. The main font size should not be specified. It should be left as the default. Also, the 0.75em font size could be for smallcaps. I cannot say without seeing the code.

You shouldn't willy-nilly change font sizes with knowing what you are changing. if you have the unchanged code, you can post samples so we can see what it is you are changing.
JSWolf is offline   Reply With Quote
Advert
Old 11-12-2020, 10:11 AM   #6
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
I have a blunt-instrument approach that works for cases where the css is in em and there are small fonts:
Search for font-size: 0\.\d+em;
Replace with: font-size: 1em;
I run this on the css file(s) to get rid of those small sizes in quotations and so on. It doesn't fix everything, but it's helpful on many books. All the "0.nnem" sizes become 1em.

There is a regex function that was posted here some long time ago that is also quite helpful, so probably worth repeating, that lets you redefine font size key words to em, and roll your own mapping:

Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    # Match from list of size keywords
    i = ["medium", "small", "large", "x-small", "xx-small", "x-large", "xx-large", "larger", "smaller"].index(match.group(1))
    # Map of corresponding sizes. Adjust as needed.
    size = ["1em", "1em", "1.2em", ".9em", ".9em", "1.3em", "1.5em", "1.1em", ".9em"]
    
    return size[i]
retiredbiker is offline   Reply With Quote
Old 11-12-2020, 10:35 AM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by retiredbiker View Post
I have a blunt-instrument approach that works for cases where the css is in em and there are small fonts:
Search for font-size: 0\.\d+em;
Replace with: font-size: 1em;
I run this on the css file(s) to get rid of those small sizes in quotations and so on. It doesn't fix everything, but it's helpful on many books. All the "0.nnem" sizes become 1em.

There is a regex function that was posted here some long time ago that is also quite helpful, so probably worth repeating, that lets you redefine font size key words to em, and roll your own mapping:

Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    # Match from list of size keywords
    i = ["medium", "small", "large", "x-small", "xx-small", "x-large", "xx-large", "larger", "smaller"].index(match.group(1))
    # Map of corresponding sizes. Adjust as needed.
    size = ["1em", "1em", "1.2em", ".9em", ".9em", "1.3em", "1.5em", "1.1em", ".9em"]
    
    return size[i]
But that mapping can screw things up. For example, I've seen plenty of cases where a font size of small is used for the copyright page. Also, small is sometimes used for smallcaps.

What I do is remove any funky font sizes. So if small is used for the base font size, I'll dump it and also fix x-small to small. I prefer no font size specified for the base font. Sometimes offset text is in a smaller size and I'll fix that as well. The more you work with the CSS, the more you'll learn and then you'll be able to edit better especially when the code is a mess (aka Vellum).
JSWolf is offline   Reply With Quote
Old 11-12-2020, 02:53 PM   #8
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
Quote:
But that mapping can screw things up.
Of course! Any of these short-cuts have to be used with discretion. But if I can fix 99 problems with a short-cut and create only 1 new one to get fixed manually, it generally seems a good trade (as long as I can find the new one).
Since I'm mostly fixing up books just for my own elderly eyes, I can also let a lot of stuff slide: get the main text OK, and I don't much care if the copyright page is messed up...I won't be sharing it with anyone else.
retiredbiker is offline   Reply With Quote
Old 11-12-2020, 08:11 PM   #9
Thasaidon
Hedge Wizard
Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.
 
Thasaidon's Avatar
 
Posts: 802
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
Quote:
Originally Posted by retiredbiker View Post
I don't much care if the copyright page is messed up...I won't be sharing it with anyone else.
I just delete the copyright page along with any other useless ,to me, pages. I won't be sharing them with anyone else either.
Thasaidon is offline   Reply With Quote
Old 11-18-2020, 12:48 PM   #10
Gandulf
Addict
Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.Gandulf ought to be getting tired of karma fortunes by now.
 
Gandulf's Avatar
 
Posts: 210
Karma: 4491791
Join Date: Jul 2020
Location: South Africa
Device: Kindle PW4
Just make a rule in Transform styles, then when you convert to ebook it will be done.

Font-size is less than X
Change the value to X .

By playing around to can probably make all font size the same, including headings.

My2c
Gandulf is offline   Reply With Quote
Old 11-18-2020, 04:34 PM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Gandulf View Post
Just make a rule in Transform styles, then when you convert to ebook it will be done.

Font-size is less than X
Change the value to X .

By playing around to can probably make all font size the same, including headings.

My2c
It's a lot better to learn to do this yourself. Then you can do it properly and have font sizes as you want them. And by doing it yourself, you learn CSS.
JSWolf is offline   Reply With Quote
Old 11-18-2020, 07:44 PM   #12
Thasaidon
Hedge Wizard
Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.
 
Thasaidon's Avatar
 
Posts: 802
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
Quote:
Originally Posted by JSWolf View Post
It's a lot better to learn to do this yourself. Then you can do it properly and have font sizes as you want them. And by doing it yourself, you learn CSS.
That is how I learnt.

I then moved on to using transform.

Now I first run Remove unused CSS in Calibre editors . . It can be surprising how many unused rule it deletes It also stacks identical rules, again stacks can be surprisingly large.

Now I am able to look at the CSS Rules and say, that one is redundant, that styles text in a way I do not like, and that one boils down to make the text italic. Then I delete the unwanted style rules and run Remove unused CSS in Calibre editors again. This will now remove styles from the html that had style rules in the CSS but they have been deleted.

I then check what each of the remaing CSS rules do and look at their use in the html. If it does something I want, I change the rule name in the html to the name I use for the rule in my stylesheet I then delete the rule from the original stylesheet. Often these original rules only apply to a single word or letter. Eventually I often end up with a blank stylesheet.

I then paste my standard CSS into the blank stylesheet. I love clips and snippets.

I then just need to eyeball the code/preview to see if I have missed something somewhere. I finally run Remove unused CSS again to remove the unused rules from my stylesheet. Normally I am left with four or five rules.

If there are tables, lists and/or lots of pictures in an eBook I do not touch the styling for these items and paste my CSS rules above them in the stylesheet.

For a siimple novel this process can take about 20 to 30 minutes. For a complicated book where almost every word is individually styled it can take anything from 2 to 4 hours.

Last edited by Thasaidon; 11-18-2020 at 07:49 PM. Reason: Multiple typos
Thasaidon is offline   Reply With Quote
Old 11-19-2020, 12:48 AM   #13
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,586
Karma: 14328510
Join Date: Nov 2019
Device: none
You can just completely blow away the existing CSS. The ereader has somewhat reasonable defaults. Try opening the ebook in calibre's editor and renaming the css files, then save it, then open it in Calibre's viewer. It may not be pretty but it's usable.

(Although the above won't work in the unfortunate situation where there are style= things on the individual html tags. There's a special place in Hades for authors who do that.)
hobnail is offline   Reply With Quote
Old 11-19-2020, 03:27 AM   #14
Thasaidon
Hedge Wizard
Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.Thasaidon ought to be getting tired of karma fortunes by now.
 
Thasaidon's Avatar
 
Posts: 802
Karma: 19999999
Join Date: May 2011
Location: UK/Philippines
Device: Kobo Touch, Nook Simple
Quote:
Originally Posted by hobnail View Post
(Although the above won't work in the unfortunate situation where there are style= things on the individual html tags. There's a special place in Hades for authors who do that.)
You said it.

Thanks for the suggestion.

Two things

1.I enjoy tinkering with the eBooks' html
2. I like reading eBooks with my idiosyncratic styling
Thasaidon is offline   Reply With Quote
Old 11-19-2020, 06:58 AM   #15
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hobnail View Post
You can just completely blow away the existing CSS. The ereader has somewhat reasonable defaults. Try opening the ebook in calibre's editor and renaming the css files, then save it, then open it in Calibre's viewer. It may not be pretty but it's usable.

(Although the above won't work in the unfortunate situation where there are style= things on the individual html tags. There's a special place in Hades for authors who do that.)
Sorry, but no. You cannot blow away the CSS. Reasonable defaults hah! Sorry, but blowing away the CSS is a very bad idea. It's not all that difficult to fix the CSS. So just ix the CSS instead of wrecking the eBook.

I've never had an eBook take hours to fix.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moon+ Reader your favorite font and font size? loodio Android Devices 6 01-30-2016 06:50 PM
Problem changing font size using font size key Waylander Conversion 0 10-02-2013 03:30 PM
Determine font and font size on incoming epub? peaceridge Calibre 4 01-30-2012 03:35 PM
PRS-300 Med font size too big, but small font size too small eli2k Sony Reader 4 05-28-2010 09:47 AM


All times are GMT -4. The time now is 08:34 PM.


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