Skip to content
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

cre: toggable enhanced rendering (floats, collapsed margins...) #5117

Merged
merged 5 commits into from Jul 15, 2019

Conversation

@poire-z
Copy link
Contributor

commented Jul 14, 2019

Adds a "Render mode" toggle with 4 modes, to enable some or all of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess with bookmarks, and "web" (all of the new features) for new books.

image

Details and screenshots at koreader/crengine#299

(Unit tests updated mostly because of collapsed margins which make fewer pages, with sample.txt too, and H3 ActI H3 Prologue in same DocFragment now on a same page in juliet.epub.)

Closes #2652 Floating image with caption does not respect width/float
Closes #2843 CSS auto margins are ignored, cannot center element
Closes #2858 CSS: Margins do not collapse properly
Closes #2878 Negative margins are ignored
Closes #3432 Some CSS weaknesses

Also:

  • Prettier CSS when viewing HTML
  • Style tweaks: update for latest epub.css, added a few more
  • Update Wikipedia EPUB stylesheet to allow floating thumbnails:
    wikipedia1

bump crengine:

  • Fix bad word spacing in lines ending with a single char word koreader/crengine#298
  • Fix "list-style-position: inside" with "list-style-type: none"
  • Fix missing in-page footnotes from imbricated tables
  • Avoid page split with lines taller than page height
  • CSS: adds more attribute selectors, handle case insensitivity flag
  • Allow reentrant use of LVFormatter koreader/crengine#299
  • EBR1/9 Enhanced Block Rendering: selectable features set
  • EBR2/9 CSS: parse and store "float:" and "clear:"
  • EBR3/9 DOM/initRendMethod: wrap floats in a floatBox element
  • EBR4/9 Upgrade RenderRectAccessor to cache new fields
  • EBR5/9 Implement enhanced renderBlockElement()
  • ERB6/9 Enhanced final block rendering and text formatting
  • EBR7/9 Update drawing code to handle floats and overflows
  • EBR8/9 Update XPointers/pt translation methods to handle floats
  • EBR9/9 Add "-cr-only-if:" private CSS property, update epub.css
  • Adds HTML5 suggested rendering stylesheet (html5.css) koreader/crengine#300

bump base

bump base, crengine: enhanced block rendering
base:
- Bump FreeType to 2.10.1
- [Android] some tolino/nook waveform fixes
- Update FBInk to 1.17.0

crengine:
- Fix bad word spacing in lines ending with a single char word
- Fix "list-style-position: inside" with "list-style-type: none"
- Fix missing in-page footnotes from imbricated tables
- Avoid page split with lines taller than page height
- CSS: adds more attribute selectors, handle case insensitivity flag
- Allow reentrant use of LVFormatter
- EBR1/9 Enhanced Block Rendering: selectable features set
- EBR2/9 CSS: parse and store "float:" and "clear:"
- EBR3/9 DOM/initRendMethod: wrap floats in a floatBox element
- EBR4/9 Upgrade RenderRectAccessor to cache new fields
- EBR5/9 Implement enhanced renderBlockElement()
- ERB6/9 Enhanced final block rendering and text formatting
- EBR7/9 Update drawing code to handle floats and overflows
- EBR8/9 Update XPointers/pt translation methods to handle floats
- EBR9/9 Add "-cr-only-if:" private CSS property, update epub.css
- Adds HTML5 suggested rendering stylesheet (html5.css) (#300)
@Frenzie

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

@poire-z I'll tag the 2019.07 release today or tomorrow and then we'll merge this after?

@Frenzie Frenzie added this to the 2019.08 milestone Jul 15, 2019

@poire-z

This comment has been minimized.

Copy link
Contributor Author

commented Jul 15, 2019

I'll tag the 2019.07 release today or tomorrow and then we'll merge this after?

Yep, fine with me (it felt like you were going to skip the july release :) so I went ahead with this).

@Frenzie

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

I like to put in a little bit more effort in terms of writing release notes & testing. :-)

(But I do use it regularly, so at least there are no bugs that break my personal workflow. :-D)

{
id = "headings_align_center",
title = _("Center headings"),
description = _("Middle align headings."),

This comment has been minimized.

Copy link
@Frenzie

Frenzie Jul 15, 2019

Member

I'm not sure if that's really any clearer than center align, if not actually confusing? I think the implicit "align" part is the important one. Middle align means vertical "centering" not just in CSS but also in Excel/Calc etc.

{
id = "pure_black_and_white";
title = _("Pure black and white"),
description = _([[Enforce all text and borders to be black, and backgrounds transparent.]]),

This comment has been minimized.

Copy link
@Frenzie

Frenzie Jul 15, 2019

Member

Enforce black text and borders, and transparent backgrounds.

@@ -95,6 +95,11 @@ function Wikipedia:getWikiServer(lang)
return string.format(self.wiki_server, lang or self.default_lang)
end

-- Say who we are to Wikipedia (see https://meta.wikimedia.org/wiki/User-Agent_policy)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Jul 15, 2019

Member

Incidentally, what did it say before? Some standard LuaSec thing? Nothing?

This comment has been minimized.

Copy link
@poire-z

poire-z Jul 15, 2019

Author Contributor

Just LuaSocket 3.0-rc1.
Which wasn't causing any issue with Wikipedia, because it's a little known library.

But doing the same kind of multiple images download with "python-requests" was causing many images requests to just get some HTML error message with that URL.

So, we'll be fine if/whenever LuaSocket gets a little more noticed by Wikipedia.

@poire-z poire-z force-pushed the poire-z:enhanced_block_rendering branch from 301f404 to 6289d67 Jul 15, 2019

@Frenzie
Copy link
Member

left a comment

No further comments. 👍

@@ -586,4 +586,8 @@ function ReaderBookmark:getLatestBookmark()
return latest_bookmark
end

function ReaderBookmark:hasBookmarks()
return #self.bookmarks > 0

This comment has been minimized.

Copy link
@Frenzie

Frenzie Jul 15, 2019

Member

I just wrote no further comments, but of course just after writing it occurs to me… could it ever be undefined?

This comment has been minimized.

Copy link
@poire-z

poire-z Jul 15, 2019

Author Contributor

Shouldn't have happened with the orders things happen. But might as well check for that, so done :)

poire-z added some commits Jul 14, 2019

cre: toggable enhanced rendering (floats, collapsed margins...)
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.

Also make available the added "HTML5" stylesheet to the Style menu.
Prettier CSS when viewing HTML
Avoid wraps on comma in properties values (eg. in font list,
in rgb() values).
Also prettify CSS included in the HTML in debug view.
Style tweaks: update for latest epub.css, added a few more
- Updated "Avoid page break" tweaks to work on our latest epub.css.
- Added "New page on headings>" menu, as we no more break page on
H1, H2, H3 in EPUBs.
- Added "Center headings" as we no more have them centered.
- Added "Pure black and white" which can make some documents
  more readable.
Update Wikipedia EPUB stylesheet to allow floating thumbnails
Main thumbnails and galleries items will float in "book" and
"web" modes.
Also use a honest User-Agent when requesting Wikipedia to
comply with their policy and avoid rate limitation (and
broken images).

@poire-z poire-z force-pushed the poire-z:enhanced_block_rendering branch from 6289d67 to 1112afa Jul 15, 2019

@poire-z poire-z merged commit 642aed2 into koreader:master Jul 15, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@poire-z poire-z deleted the poire-z:enhanced_block_rendering branch Jul 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.