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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-14-2011, 06:05 PM   #1
sciurius
Member
sciurius doesn't littersciurius doesn't litter
 
sciurius's Avatar
 
Posts: 20
Karma: 102
Join Date: Sep 2010
Location: 52.88504N 06.85904E
Device: PC
Fontsize independent text width

For a particular book, I have a style sheet that defines:

p {
font-family: Arial, "sans-serif";
font-size: 21pt;
margin-left: 2.7em;
margin-right: 2.7em;
text-align: left;
}

I also have a version with smaller font size:

p {
font-family: Arial, "sans-serif";
font-size: 18pt;
margin-left: 5.1em;
margin-right: 5.1em;
text-align: left;
}

In either version, the word breaks of the text are at exactly the same places. In other words, the page looks exactly the same in both versions except for the size (and margins).

To make the style settings independent of the font size, I want to use max-width instead of margin-right. Some experimenting reveals that I have to use max-width: 26.4em for the 21pt version, and 26.9em for the 18pt version. This is surprising, since I'd expect exactly the same value for both versions. max-width is expressed in terms of em so it should be independent of the font size. 0.5em difference is just too much to ignore.

What am I missing in the calculations?
sciurius is offline   Reply With Quote
Old 08-14-2011, 06:56 PM   #2
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,216
Karma: 5940079
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by sciurius View Post
For a particular book, I have a style sheet that defines:

p {
font-family: Arial, "sans-serif";
font-size: 21pt;
margin-left: 2.7em;
margin-right: 2.7em;
text-align: left;
}

I also have a version with smaller font size:

p {
font-family: Arial, "sans-serif";
font-size: 18pt;
margin-left: 5.1em;
margin-right: 5.1em;
text-align: left;
}

In either version, the word breaks of the text are at exactly the same places. In other words, the page looks exactly the same in both versions except for the size (and margins).

To make the style settings independent of the font size, I want to use max-width instead of margin-right. Some experimenting reveals that I have to use max-width: 26.4em for the 21pt version, and 26.9em for the 18pt version. This is surprising, since I'd expect exactly the same value for both versions. max-width is expressed in terms of em so it should be independent of the font size. 0.5em difference is just too much to ignore.

What am I missing in the calculations?
Margins should probably be a fixed size value (not in em) to avoid different margins with different fonts or (user) scaling.
theducks is online now   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
Flightcrew : is px for the height/width forbidden ? NicolasR Sigil 2 02-11-2011 04:51 AM
PRS-300 Fixed-width fonts for text files. seanhennessy Sony Reader 0 09-24-2010 12:41 PM
Page Width kobo2010 Kobo Reader 4 05-10-2010 09:14 PM
Using the width attribute crutledge Workshop 8 07-06-2009 06:10 AM
Centering and adjusting the width of a block Jellby ePub 3 04-09-2009 01:38 PM


All times are GMT -4. The time now is 04:21 PM.


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