-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Question: fb2 in-page footnotes justified #6344
Comments
A user style tweak with this should work: body[name="notes"] section,
body[name="comments"] section {
text-align: justify !important;
} Does that work ? I added recently koreader/frontend/apps/reader/modules/readerstyletweak.lua Lines 591 to 602 in 8a61e70
Because I sometimes (but rarely) got them non-justified, and I figured it would not hurt there (a user can just erase that sample line). Dunno if we should switch all in-page footnotes tweaks to text-align: justify .
|
Even if it works, can you try to see where a text-align: left comes from. Obviously, it's not you who set it via another style tweak. |
The user style tweak doesn't work. |
I've applied the sample of Book-specific tweak - doesn't work. |
I cannot trace the source of the text-align:left instruction, the html code shows just [body name="notes"], [section] and [p]. |
Try this, forcing it on all descendants: body[name="notes"] section *,
body[name="comments"] section * {
text-align: justify !important;
} It's only on this specific FB2 book (can you share it?), or does it happen with all FB2 books? |
Doesn't work. All fb2 books. |
So, please share one (that you can share), so we can see if it's you only - and if I can reproduce I'll investigate. Btw, on your first post, it seems fine on the 2nd screenshot (?) - or did I not undestand the issue? |
The second screenshot shows popup footnote which is Okay. |
Oh, right :) OK, I can reproduce it - and it does not happen with a koreader 2020.04.1-12 I had around. |
Caused by koreader/crengine@28ae22c and probably related to the specific |
I've changed in fb2.css run-in to auto and got justified footnote, the text starting the next line of the footnote number. User style tweak works. |
Should be fixed with koreader/crengine#353. |
Thank you very much, I'll wait for the build to test. |
Can in-page footnotes follow the alignment settings of the main text? |
For FB2, they did, and they will with the fix. With EPUBs, it's more wild, as they can be in a DIV, and some publisher can explicitely set them to |
Nice, in fb2 books by default we will have both main text and in-page footnotes justified (as per fb2.css setting for |
That is (and has been for a long time - it's original upstream code) explicitely done by adding 2 UNICODE_NO_BREAK_SPACE between the number and the text: So, I guess someone prefered them that way, unless it's just some technical trick, not sure.
Btw, I dropped the idea of using |
And which do you prefer ? |
One space as in popup. |
Good day, This book shows no space after number in popup footnotes. This book has [stylesheet] section in the beginning (which is rare for fb2 books from Flibusta). |
Unlike most of the others FB2, this one have the footnotes part stuck to each other in the source: <section id="n_6"><title><p>[6]</p></title><p><emphasis>¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿</emphasis> (1836¿1914) ¿ ¿¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿, ¿¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿ ¿¿¿¿ ¿ ¿¿¿¿ ¿¿¿¿¿-¿¿¿¿¿¿¿ ¿¿¿¿¿; ¿ 1895¿1903 . ¿¿¿¿¿¿¿ ¿¿¿¿ ¿¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿.</p>
</section> (pardon my latin1 not showing cyrillic :) <section id="n_10">
<title>
<p>10</p>
</title>
<p>¿¿¿¿¿¿¿¿ ¿ ¿¿. ¿¿¿¿¿¿. ¿¿¿¿¿.</p>
</section> So, when giving all that as-is to MuPDF, it gets some space between nodes and can show, once collapsed, at least a space between the number and the text - that it doesn't get in the first case. I guess I could force adding one space after a node with For the italic missing, FB2 has some non-standard HTML tags (like koreader/frontend/ui/widget/footnotewidget.lua Lines 57 to 111 in f4dad2f
One would need to find out the ones that need to be formatted differently. Quick glance and I see |
Will it be hardcoded that, say, [emphasis] is italic? Actually, it can be bold if one prefers to set it in fb2.css. |
It would be hardcoded (in footnotewidget.lua) in what we give to MuPDF for rendering popup footnotes. So, it should probably be the same as what we decided to be the default formatting for these tags in fb2.css. |
Yeah, the same here. I haven’t seen a table in my fb2 books yet, but for the sake of a table being just a well-structured text, I’d go with decoration as simple as possible |
About buggins/coolreader@ccac737: I just restored the legacy table view style (which was in the old CoolReader). May be we must create separate fb2.css for e-ink devices, for example fb2-eink.css (and corresponding for epub, etc formats). I'm not sure, maybe the koreader is only for e-ink devices, so this is not a actual idea? |
I would agree that ridge isn't the best looking option. I generally prefer a simple solid or nothing. |
It's probably not some empty line of text, but some margin - precisely some collapsed margin from previous content. Each footnote is a slice of the document, the part that contain that SECTION: This margin collapsing is per-specs (koreader/crengine#299). I have some patch (date Feb 13th) where I tried to fix that, that I did not follow up, probably because it caused some other issues: --- a/crengine/src/lvrend.cpp
+++ b/crengine/src/lvrend.cpp
@@ -6561,8 +6561,15 @@ void renderBlockElementEnhanced( FlowState * flow, ldomNode * enode, int x, int
// Enter footnote body only after padding, to get rid of it
// and have lean in-page footnotes
- if ( isFootNoteBody )
+ if ( isFootNoteBody ) {
+ // If no padding were added, add an explicite 0-padding so that
+ // any accumulated vertical margin is pushed here, and not
+ // part of the footnote
+ if (padding_top==0) {
+ flow->addContentLine(0, RN_SPLIT_AFTER_AVOID, 0, true);
+ }
flow->getPageContext()->enterFootNote( footnoteId );
+ }
// recurse all sub-blocks for blocks
int cnt = enode->getChildCount(); I can't get what you got with the FB2s I got from you. body[name="comments"] > section:first-of-type,
body[name="notes"] > section:first-of-type {
padding-top: 1px;
}
/* or */
body[name="comments"] > title,
body[name="notes"] > title {
margin-bottom: 0;
} |
Thank you, I'll play with some settings. Here is the book if you are interested to try. |
OK, I got it - and also with your other FB2 documents (somehow, I had all of them with render mode legacy :) --- a/frontend/ui/data/css_tweaks.lua
+++ b/frontend/ui/data/css_tweaks.lua
@@ -654,37 +654,46 @@ Show FB2 footnote text at the bottom of pages that contain links to them.]]),
-- match in any other kind of document
css = [[
body[name="notes"] section {
-cr-only-if: fb2-document;
-cr-hint: footnote-inpage;
margin: 0 !important;
}
body[name="notes"] > section {
-cr-only-if: fb2-document;
font-size: 0.75rem;
+}
+body[name="notes"] > title {
+ margin-bottom: 0; /* avoid title bottom margin from collapsing into */
+ padding-bottom: 0.5em; /* the first footnote by by substituting it with padding */
}
]],
}, |
I mean, I can do it via User style tweaks, but shouldn't it be by default? Well, the same is in poems (which are in italic by default). |
How did you do it, what tweak did you came up with?
For EPUB, I'd say it shouldn't (we respect cascading style sheets as the publisher might expect it). |
|
We already have: |
Am I right that by default a nested (cascading) element should always inherit style of its parent strictly without exclusions? |
Half right. edit: ok, font-size is in that list at that link. It means the computed font size is inherited, but not the specified property value. |
OK, thank you for your comments. |
Seems to have an issue showing poem/stanza in footnotes - no line breaks. |
(Unrelated to previous comment.) Footnote numbers may not be perfectly aligning (because digits have non-constant widths), but we could get something a bit nicer when the font has the --- a/cr3gui/data/fb2.css
+++ b/cr3gui/data/fb2.css
@@ -104,10 +104,11 @@ pre {
body[name="notes"] section title,
body[name="comments"] section title {
display: run-in; /* technical trick to have the footnote number inline with the followup text */
font-weight: bold;
font-size: 100%; /* counteract default of 110% with regular title */
+ font-variant: tabular-nums; /* get fixed-width digits for nicer text alignment */
text-align: start; /* counteract default of center with regular title */
page-break-before: auto; /* counteract default of always with regular title */
page-break-inside: auto;
page-break-after: auto;
} |
I agree, it may be accepted. |
By "supported", you meant "styled", right ? koreader/frontend/ui/widget/footnotewidget.lua Lines 93 to 96 in 671ea00
Like for your poem above: --- a/frontend/ui/widget/footnotewidget.lua
+++ b/frontend/ui/widget/footnotewidget.lua
@@ -94,6 +94,8 @@ body > li { list-style-type: none; }
emphasis { font-style: italic; }
strikethrough { text-decoration: line-through; }
underline { text-decoration: underline; }
+text-author { font-weight: bold; font-style: italic; margin-left: 5%}
+poem, stanza, v { display:block; }
/* Attempt to display FB2 footnotes as expected (as crengine does, putting
* the footnote number on the same line as the first paragraph via its I let you compile them if you want me to add them here. |
Got it, thanks. |
https://github.com/poire-z, can you please help me to have fb2 in-page footnotes justified, same as popup footnote.
I've played with User style tweaks, cr3.ini, footnotewidget.lua with no success.
The text was updated successfully, but these errors were encountered: