Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-20-2023, 04:33 AM   #1
jugaor
Enthusiast
jugaor began at the beginning.
 
jugaor's Avatar
 
Posts: 30
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
Monospace font sizes

Hello.
I have noticed that, in certain apps, texts in monospaced font appear smaller than the rest.

I found this:
https://github.com/necolas/normalize.css
Quote:
The font-family: monospace, monospace hack fixes the inheritance and scaling of font-size for preformatted text. The duplication of monospace is intentional.
So I have tried the above, changing:
Code:
code, kbd, samp, pre, .mono, .mono p {
  font-family: monospace;
}
to:
Code:
code, kbd, samp, pre, .mono, .mono p {
  font-family: monospace, monospace;
}
So far the "unifying" effect looks good in:

Aldiko
Click image for larger version

Name:	Aldiko_once.jpg
Views:	84
Size:	30.1 KB
ID:	204353Click image for larger version

Name:	Aldiko_twice.jpg
Views:	82
Size:	33.2 KB
ID:	204354

Lithium
Click image for larger version

Name:	Lithium_once.jpg
Views:	77
Size:	46.2 KB
ID:	204355Click image for larger version

Name:	Lithium_twice.jpg
Views:	79
Size:	51.8 KB
ID:	204356

PocketBook (Auto/Standard engine)
Click image for larger version

Name:	Pocketbook_once.jpg
Views:	78
Size:	29.8 KB
ID:	204357Click image for larger version

Name:	Pocketbook_twice.jpg
Views:	73
Size:	32.5 KB
ID:	204358

Reasily
Click image for larger version

Name:	Reasily_once.jpg
Views:	71
Size:	49.0 KB
ID:	204359Click image for larger version

Name:	Reasily_twice.jpg
Views:	76
Size:	52.9 KB
ID:	204360

Calibre viewer (Windows)
Click image for larger version

Name:	Calibre_once.jpg
Views:	77
Size:	35.5 KB
ID:	204361Click image for larger version

Name:	Calibre_twice.jpg
Views:	84
Size:	39.7 KB
ID:	204362

In apps that don't seem to need them (ADE, Google PlayBooks, Koodoo, Thorium, etc.) they don't affect them either.
On the other hand, duplicating the definition of the other families (sans, serif) has no effect. They always look good (as seen in the screenshots).

Has anyone else tried this? Could it cause any problems?

Cheers!
jugaor is offline   Reply With Quote
Old 10-28-2023, 03:05 PM   #2
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: 74,022
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Forget that normalize.css. It's rubbish for eBooks.

Just put in the code for monopsace and let it be. There's no way to make it work in every program that displays ePub. For example, a lot of Android programs, you'll find they don't work well.

You cannot code for every program. You code for what's correct and if the program someone is using doesn't work, it's not your fault.
JSWolf is online now   Reply With Quote
Old 11-16-2023, 01:27 AM   #3
jugaor
Enthusiast
jugaor began at the beginning.
 
jugaor's Avatar
 
Posts: 30
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
JSWolf, thanks for your reply.

I agree with you that huge 'reset' or 'normalize' blocks are generally unnecessary, but this little hack seems to be useful to prevent monospaced texts from looking tiny.
In any case, I only place it when code or another monospace class is actually used in the epub.

BTW, I have continued testing and with the Big Three they look like this:

Apple iBooks (v15)
Click image for larger version

Name:	iBooks_once.jpg
Views:	39
Size:	64.7 KB
ID:	204728 Click image for larger version

Name:	iBooks_twice.jpg
Views:	33
Size:	70.0 KB
ID:	204729

Kindle (azw3 /Calibre)
Click image for larger version

Name:	Kindle_azw3_once.jpg
Views:	34
Size:	63.5 KB
ID:	204730 Click image for larger version

Name:	Kindle_azw3_twice.jpg
Views:	36
Size:	69.8 KB
ID:	204731

Kobo (kepub /kepubify)
Click image for larger version

Name:	Kobo_kepub_once.jpg
Views:	39
Size:	64.8 KB
ID:	204732 Click image for larger version

Name:	Kobo_kepub_twice.jpg
Views:	33
Size:	72.0 KB
ID:	204733
(as we know, Kobo doesn't yet have a monospaced font... but it does resize just like other engines. Epub —read by ADE— has no differences.)

I leave it here in case anyone else finds it useful.
Thanks for your attention!
jugaor is offline   Reply With Quote
Old 11-16-2023, 11:58 AM   #4
nabsltd
Evangelist
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
Quote:
Originally Posted by jugaor View Post
I agree with you that huge 'reset' or 'normalize' blocks are generally unnecessary, but this little hack seems to be useful to prevent monospaced texts from looking tiny.
Since this only occurs with a few renderers, and it's always because the font being chosen is the fallback monospace and not a specific monospace font, I've never had a problem, because I embed the monospace font that I want the reader to see.

https://fonts.google.com/?classification=Monospace lists 40 font families, all free to use in eBooks, even if you are selling the books.
nabsltd is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the size of the monospace font? pickyaxe KOReader 7 07-12-2021 10:16 PM
lack of monospace / fixed width font lumpynose Kobo Reader 12 08-26-2019 11:55 PM
Smaller monospace font? Action Superhero Kindle Formats 1 03-30-2016 11:27 AM
HTML to ePUB with monospace font il_mix Conversion 12 06-28-2013 10:07 AM
* to Mobi: setting monospace font size Starko Conversion 7 11-16-2012 03:04 PM


All times are GMT -4. The time now is 07:06 PM.


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