-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Style>Auto, fb2.css, epub.css, html5.css #11494
Comments
I guess the answer should be to be able to pick a default per document type, although that sounds a bit annoying to implement. :-) |
So, html5.css will grow by 50%, with added proper selectors. It's obviously a bit slower to load a book, but not that much (a big book taking 34s on my Kobo with our old html5.css would now take 36 s to load). If we want epub.css to benefit from the html5.css improvements (and not have to maintain things in 2 .css files), we can just I did the exercice, and came up with the following. @import "html5.css" /* HTML standard */
/* Extend html5.css with tweaks to make it more "book" looking and less
* like a web page, especially needed with unstyled EPUB/HTML documents.
* (styling similar to what we got with our older epub.css). */
/* Text justified by default */
body {
text-align: justify;
}
/* Constant margin on all levels */
h1, h2, h3, h4, h5, h6 {
margin-top: 0.7em;
margin-bottom: 0.5em;
hyphens: none;
}
/* Less radical font size changes */
h1 { font-size: 150%; }
h2 { font-size: 140%; }
h3 { font-size: 130%; }
h4 { font-size: 120%; }
h5 { font-size: 110%; }
h6 { font-size: 100%; }
/* Paragraphs: no spacing between them, and text-indentation */
p {
text-indent: 1.2em;
margin-top: 0;
margin-bottom: 0;
}
/* Blockquote: smaller margins, based on font size; unbalanced but fine */
blockquote {
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 2em;
margin-right: 1em;
}
blockquote:dir(rtl) {
margin-left: 1em;
margin-right: 2em;
}
/* HR: less 1990s HTML */
hr {
border-style: solid;
}
/* Lists: no vertical margin, a bit of margin left added to our -cr-special padding */
ul, ol {
margin-left: 1em;
margin-top: 0;
margin-bottom: 0;
}
ul:dir(rtl), ol:dir(rtl) {
margin-left: unset;
margin-right: 1em;
}
/* Definitions: smaller margins all around, dt bold */
dl {
margin-left: 0;
}
dt {
margin-left: 0;
margin-top: 0.3em;
font-weight: bold;
}
dd {
margin-left: 1.3em;
}
dd:dir(rtl) {
margin-left: unset;
margin-right: 1.3em;
}
/* Tables: smaller font size (for less wrapping and less height taken on our small screens) */
table {
font-size: 80%;
margin: 3px 0;
border-spacing: 1px; /* needed for separate border to not look uneven */
}
table table { /* stop imbricated tables from getting smaller */
font-size: 100%;
}
/* A bit more default padding in cells */
td, th {
padding: 3px;
}
/* Background by default on table headers, and text-align center */
th {
background-color: #DDD;
text-align: center;
}
/* Same for caption */
table caption {
padding: 4px;
background-color: #EEE;
}
/* Pre: smaller vertical margins, drop our inherited justification */
pre, xmp {
text-align: left;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
/* sup/sub: smaller font size */
sup { font-size: 70%; }
sub { font-size: 70%; }
/* Make links noticable */
a {
text-decoration: underline;
color: gray;
}
/* EPUB3: also hide any <nav hidden=""> made available in the book content,
* which could be a huge list of reference page numbers */
/* nav[hidden] { display: none; } */
/* Taken care of in html5.css by a generic [hidden] */
/* Keep ensuring this in legacy rendering */
h2, h3 {
-cr-only-if: legacy -epub-document;
page-break-before: always;
}
/* Old element or className based selectors involving display: that we need
* to support for older gDOMVersionRequested (these were fixed in 20180528).
* DO NOT MODIFY BELOW to not break past highlights */
@media (-cr-max-cre-dom-version: 20180527) {
/* Images are now inline by default, and no more block with exceptions */
img { text-align: center; text-indent: 0; display: block; }
sup img { display: inline; }
sub img { display: inline; }
a img { display: inline; }
p img { display: inline; }
p image { display: inline; } /* non html */
/* With dom_version < 20180528, unknown elements defaulted to 'display: inherit'
* These ones here were explicitely set to inline (and some others not
* specified here were also set to inline in fb2def.h */
b, strong, i, em, dfn, var, q, u, del, s, strike, small, big, sub, sup, acronym, tt, samp, kbd, code {
display: inline;
}
form { display: none; }
.title, .title1, .title2, .title3, .title4, .title5, .subtitle { display: block; }
.fb2_info { display: block; }
.code { display: block; }
} (For reference for the curious, our future html5.css: html-standard.css.txt, with its default values we don't need to override). Another way to go at that would be to keep only html5.css (and have it as the default for html/epubs/anything not FB2), and have all our above tweaks in a (huge) style tweak (named Thoughts welcome. |
And if one has read up to here (thank you!), I'm still looking for thoughts about what to do with Wikipedia EPUBs :) #10770 (comment) |
Hi @poire-z I still do some books by hand though, via Book-specific style tweaks. For example, some books have different class names for images I would like to have centered. |
I mean, current implementation is great: fb2 books open with fb2.css, epub with html (I think? I don't read many epubs, can't remember) |
I'd just go with book. :-) |
|
That's an answer to which of my questions ? (sorry for asking, I asked so many :)) |
@poire-z This one(s) :D |
Ok :) epub.css is our tweaks to that standard rendering to make it look more like a paper book (or book, or ebook) than like a web page. |
Typographical book layout? |
Electronic parchment Maybe something in the direction of "traditional book"? |
The help_text: Printing press book feels a bit technical. What would sound/work better: paper book ? hardcopy book ? real book ? |
Paginated books vs scrollable web pages? |
Just a regular paper book sounds best to me. |
So, going in #11527 with: |
The alliteration in I think elsewhere in the descriptions we say |
I'll fix the ie, and move the parens nearer to what it applies to: I like the sound of |
Book layout? |
Like I said I like book look. ;)
…On Sat, Mar 9, 2024, 13:37 mergen3107 ***@***.***> wrote:
Book layout?
Book formatting?
Book typesetting?
—
Reply to this email directly, view it on GitHub
<#11494 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQBPT7JDTUWY7WHPIGETYXL7AXAVCNFSM6AAAAABDZDK4B2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWHA2DKNZXHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'll soon be PR'ing stuff to crengine to support most of the HTML standard specs, see koreader/crengine#551.
Nothing fancy, just some old stuff we may still find in documents (like
<table cellpadding="3" border valign="bottom">
and...<body bgcolor="red" text="blue">
and<font face="Georgia" size=2>
, and<center>
!, so that KOReader and crengine are ready for when HTML2 comes out in a year or two, in 1997 or 1998 ! :)There will be style tweaks to disable that possibly annoying stuff, but it's better to support that kind of stuff than not (cf. #10770).
So, this will update html5.css.
Then, we have our epub.css, that is currently lightweight, not having as much stuff as html5.css, but still being good enough for most books. But still...
I'm not yet deciding if our default should change (#10770 (comment)) - but see next post.
Anyway, users can and will be able to chose their default between epub.css or html5.css as currently.
But there is an issue with setting html5.css as the default: FB2 documents will then open with html5.css ! which will be bad.
That means that people reading FB2 can't decide to set html5.css as their default for EPUBs, and are stuck with epub.css (and its side effects on styled publisher books).
So, what are your thoughts about this
Style > Auto
? Does it has some sense? Should we get rid of it?Should we force FB2 to open with fb2.css no matter what has been set as the default (which then will be a default for all HTML based documents, so not FB2) ?
@mergen3107 : I remember you have tweaked our fb2.css to your liking. Do you override ours with yours? Have you given it another name? How do you get it to apply on new FB2 books you open?
Any other thoughts?
The text was updated successfully, but these errors were encountered: