Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

View Poll Results: What unit should I use ?
em 5 55.56%
pt 1 11.11%
px 1 11.11%
none of the above 1 11.11%
it doesn't matter, all are ok 1 11.11%
Voters: 9. You may not vote on this poll

Reply
 
Thread Tools Search this Thread
Old 05-02-2010, 02:12 PM   #1
NASCARaddicted
Addict
NASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and grace
 
Posts: 310
Karma: 43106
Join Date: Apr 2009
Location: Germany
Device: BeBook One, Pocketbook Touch
base font size ? What unit should I use ?

I am working on a html file that I want to convert to epub.

In the external CSS, I added this line:
Code:
body {font-size: 20pt}
so that the base font size is 20pt (I hope this code is ok, according to a CSS Check it is valid). But some people on the Internet say, that using "px" or "pt" as size unit is not good (at least not for IE). Instead I should use "em". So far I tried "pt" and it worked (but at 24pt the font was way too big on my Bebook)

I already use "em", when it comes to stuff like margins, but I don't know if em also works on the base font size. I just looked at Wikipedia, and there it says:
Quote:
This unit defines the proportion of the letter width and height with respect to the point size of the current font.
So can I use "em" as basefont size ? I mean, there is no current font. So basically "em" would be based on nothing. Or is there a default font size on any ebook reader (or at least on the ADE epub)
Or should I stick with "pt", since this works (once I figure out the ideal number)

And what about other ebook readers ? Currently, I use a Bebook that has a resolution of 800x600. What about other ebook readers with other resolutions ?

So to sum it up: What is the best basefont unit when it comes to html/css/epub ?
NASCARaddicted is offline   Reply With Quote
Old 05-02-2010, 03:03 PM   #2
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 707
Karma: 2003741
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Touch
IMHO, for ePubs, it is very bad idea to redefine the base font size. It is best left untouched, at 1em. There is, always, a default size built into the rendering software, even if you don't know what it is. It is a function of the rendering software, something specific to the target device...

If the font of the text is to small/big, let the reader software deal with it (increase/decrease of the font size on ADE readers, for example).

I use em units everywhere, which will scale nicely if user changes the default font size. It is good to keep the number of different formatting/fonts/font-sizes small, effective and completely contained in CSS. The consistency is almost a must, the same formatting should be used for all book elements of same type (all headers are the same, all quotes as well, etc.). All in all, the number of different font sizes needed for nicely rendered books is small, headers are bigger, if you use emulations of small caps, or more than one font family for elements ...

Last edited by Ankh; 05-02-2010 at 03:06 PM.
Ankh is offline   Reply With Quote
 
Enthusiast
Old 05-02-2010, 07:49 PM   #3
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,186
Karma: 604284
Join Date: Sep 2009
Device: PRS-505
As Ankh said, all readers have to define a base size for fonts, and your base font definition will use that, so setting it to 1em or 100% will simply use the default base size.

An important thing to remember is that while all readers will allow the font size to be increased, few (if any) allow it to be decreased, so the base font size is the minimum size that will be used. On my Sony 505, text at 100% renders at a height of 2.1mm, which is approximately 6pt. This size should be clearly legible to anyone with good eyesight and it provides a line measure of around 56 characters, which is close enough to the ideal of 66.

Increasing the base font size will produce clearer and better-rendered characters, at the expense of having fewer per line and less text on the page. This is a decision that's best left to the reader.
charleski is offline   Reply With Quote
Old 05-03-2010, 04:21 AM   #4
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,904
Karma: 4269879
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by charleski View Post
An important thing to remember is that while all readers will allow the font size to be increased, few (if any) allow it to be decreased, so the base font size is the minimum size that will be used.
In the Cybooks you can use smaller font sizes. I set font sizes lower than 100% for things like smallprint, superscripts, captions... and they appear smaller in the Cybook. Maybe, if I set the base font size to the smallest possible that won't be the case, but I always use the 3rd smallest size at least
Jellby is online now   Reply With Quote
Old 05-03-2010, 05:02 AM   #5
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 6,966
Karma: 3454321
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Nexus 7, Nexus 4, iPad 2, Notion Ink Adam Qi, Kindle WiFi, Kindle PW
Quote:
Originally Posted by Ankh View Post
I use em units everywhere, which will scale nicely if user changes the default font size.
This is wrong for @page. See

http://www.w3.org/TR/CSS2/page.html

Quote:
The page context has no notion of fonts, so 'em' and 'ex' units are not allowed.
tompe is offline   Reply With Quote
Old 05-03-2010, 05:10 AM   #6
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 62,063
Karma: 39198909
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Onyx T68, N7,
Quote:
Originally Posted by Ankh View Post
I use em units everywhere, which will scale nicely if user changes the default font size.
Not a good idea to define margins in "em" units. Most people do not want the size of the margins to increase, if they select larger text.
HarryT is online now   Reply With Quote
Old 05-03-2010, 08:48 AM   #7
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 707
Karma: 2003741
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Touch
Quote:
Originally Posted by Ankh View Post
I use em units everywhere, which will scale nicely if user changes the default font size.
I should have been more precise. What I wanted--but obviously failed--to say is:
Quote:
I always use em units for font sizes...
.
Ankh is offline   Reply With Quote
Old 05-03-2010, 10:05 AM   #8
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 62,063
Karma: 39198909
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Onyx T68, N7,
Thanks for clarifying that. You'd be surprised how many people do in fact define their margins in em's.
HarryT is online now   Reply With Quote
Old 05-03-2010, 10:46 AM   #9
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 707
Karma: 2003741
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Touch
Quote:
Originally Posted by HarryT View Post
Thanks for clarifying that. You'd be surprised how many people do in fact define their margins in em's.
All horizontal/vertical positioning should be handled with percent units, right?

How about the indentation of the first line in paragraph? Em's or percents?
Ankh is offline   Reply With Quote
Old 05-03-2010, 11:18 AM   #10
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,904
Karma: 4269879
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
I believe the "best" way would be some combination of absolute and relative units, with a stepwise multi-variable function definition (if font size is smaller than x, then do this, else do that; if screen width is larger than x, then do this, else do that). In CSS3 there is the calc function, that could be useful, but it's missing max/min operators anyway. ADE's conditional styling could be used too, but it's not a standard feature.

I usually set all lengths in em units, even margins, but I don't define the body margin, but the margins for blockquotes, poetry, etc.
Jellby is online now   Reply With Quote
Old 05-03-2010, 02:20 PM   #11
NASCARaddicted
Addict
NASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and grace
 
Posts: 310
Karma: 43106
Join Date: Apr 2009
Location: Germany
Device: BeBook One, Pocketbook Touch
so far I used em for all my margins. When I change the size of the font (by the zoom buttons on the ebook reader), I want that things like margins or text intend also change that way.

Where is the big difference between em and % ?

@Charleski

Talking about default font size: I just made a test with my Bebook. I took the same html file and used 3 different css files.

In the first try I did not set the body font size, I used the default of the reader. In the 2nd try, I set the base font to 1em. And with the 3rd try, I set it to 20 px.

The results: First of all: like I expected, setting no base fontsize gave the same result like setting it to 1em. The text was awfull small. I wear glasses (but the last time I had my eyes checked was less then 6months ago). I could read the text (but it wasn't easy), but I know someone like my 65 year old father would have needed a looking glass (or the zoom buttons on the Bebook)

Then I looked at some full lines with no intend (just to add: the text was justified, but contains no long words on this lines). The first line had like 87 characters, the next that I tried was 82.
When I zoomed in 1 level, it looked much better and I had around 64 characters on a line.

So I looked at the 3rd test, the one with base font set to 20px. The font size itself was much better, about 2-2.5 milimeters high. I also looked at some lines: The first one had 70 characters, the next one had 66.

I don't know, but for me, it seems as if I should use something like 20-22 (or maybe even 24) px as font size for my device.
However, if I use a different device ... oh man, everything is so complicated ...
NASCARaddicted is offline   Reply With Quote
Old 05-03-2010, 02:47 PM   #12
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,904
Karma: 4269879
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Use a device-independent absolute unit instead, like pt or mm.
Jellby is online now   Reply With Quote
Old 05-03-2010, 04:18 PM   #13
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 707
Karma: 2003741
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Touch
Quote:
Originally Posted by NASCARaddicted View Post
so far I used em for all my margins. When I change the size of the font (by the zoom buttons on the ebook reader), I want that things like margins or text intend also change that way.
You want margins to change with the font size? When you increase the font size, the number of characters displayed per line is smaller. Are you sure that you want to further decrease that number of characters by increased margins?


Quote:
Originally Posted by NASCARaddicted View Post
Where is the big difference between em and % ?
Oh, it varies, depending on the element . If font size is defined to be 150%, it is the same thing as setting it to 1.5em.

However, percents used for margin (top, bottom, left, right) are percents of width or length of the containing box, and are not affected when default font size changes.
Ankh is offline   Reply With Quote
Old 05-03-2010, 04:32 PM   #14
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,186
Karma: 604284
Join Date: Sep 2009
Device: PRS-505
Quote:
Originally Posted by Jellby View Post
In the Cybooks you can use smaller font sizes. I set font sizes lower than 100% for things like smallprint, superscripts, captions... and they appear smaller in the Cybook. Maybe, if I set the base font size to the smallest possible that won't be the case, but I always use the 3rd smallest size at least
Can the reader chose to go smaller? I'm just used to my 505 in which the book opens at the 'S' zoom level and you can make the text larger, but not smaller.

Quote:
Originally Posted by NASCARaddicted View Post
In the first try I did not set the body font size, I used the default of the reader. In the 2nd try, I set the base font to 1em. And with the 3rd try, I set it to 20 px.

The results: First of all: like I expected, setting no base fontsize gave the same result like setting it to 1em. The text was awfull small. I wear glasses (but the last time I had my eyes checked was less then 6months ago). I could read the text (but it wasn't easy), but I know someone like my 65 year old father would have needed a looking glass (or the zoom buttons on the Bebook)

Then I looked at some full lines with no intend (just to add: the text was justified, but contains no long words on this lines). The first line had like 87 characters, the next that I tried was 82.
When I zoomed in 1 level, it looked much better and I had around 64 characters on a line.

So I looked at the 3rd test, the one with base font set to 20px. The font size itself was much better, about 2-2.5 milimeters high. I also looked at some lines: The first one had 70 characters, the next one had 66.

I don't know, but for me, it seems as if I should use something like 20-22 (or maybe even 24) px as font size for my device.
However, if I use a different device ... oh man, everything is so complicated ...
Ouch, sounds like the Bebook is definitely using a default font size that's far too small. I just checked on my Sony 505, and text at 100% is slightly bigger than 20px and slightly smaller than 22px (so I'm guessing it's 21px).

This is certainly a complication. Specifying the base font size in % rests on the assumption that the device manufacturer has encoded the default as the smallest size that's comfortable for extended reading by someone with good vision. If some manufacturers are not setting up their machines properly, then it might be better to use px instead so that the user isn't having to fiddle with the zoom. The problem is that using px will definitely break in the future when we finally get devices with higher resolutions. For your current needs 20-22px sounds like the best option right now.
charleski is offline   Reply With Quote
Old 05-04-2010, 02:39 AM   #15
NASCARaddicted
Addict
NASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and graceNASCARaddicted herds cats with both ease and grace
 
Posts: 310
Karma: 43106
Join Date: Apr 2009
Location: Germany
Device: BeBook One, Pocketbook Touch
Quote:
Originally Posted by Ankh View Post
You want margins to change with the font size? When you increase the font size, the number of characters displayed per line is smaller. Are you sure that you want to further decrease that number of characters by increased margins?
Well,basically I gotta say: yes, I want margins to change with the font size.

O.k. I admit, sometimes it ain't so good: for example when it's something like the start of a chapter, I use top margin 5 em, so that there is some space before the chapter title.

However, especially when it comes to "characters per line", I see it different. With my CSS, when a new paragraph starts, it starts with a text intend of 1.5 em. And I removed the empty line between 2 paragraphs, so it really looks like a paper book.

Now let's say, I use a fixed size like for example: text intend of 1.5 centimetres or maybe 5 yards ... you know what I mean. Lets say my textsize is 1em (let's say that would be about 1 centimetre). But now I zoom in. Now, my font is twice as big as before, but the intend stays the same. Let's say I zoom again, and now my font size is 10 times as big as before (unrealistic, but I just want to make it obvious). So now my font size is about 10 cm, while the text intent still is 1.5 cm. The whole thing would look different.

@Charleski

No one knows what the future will bring, that's why I keep all my ebooks in html file with external css files. It is pretty easy to change an external css and convert it with calibre.
NASCARaddicted is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ideal base font size for ePub? eosrose ePub 5 05-28-2010 12:45 AM
ebook-convert doesn't recognize base-font-size parameter dracodoc Calibre 6 12-25-2009 10:26 PM
LIT->LRF Conversion - Quirky Base Font Size Setting orion2001 Calibre 6 09-27-2009 12:10 AM
Base Font Size not Working Colaveare Calibre 0 05-06-2009 02:09 AM
Global html2lrf/recipe base-font-size? streaml1ne Calibre 1 07-06-2008 11:59 AM


All times are GMT -4. The time now is 12:11 PM.


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