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

bump crengine: text typography by language #6069

Merged
merged 2 commits into from
Apr 19, 2020

Conversation

poire-z
Copy link
Contributor

@poire-z poire-z commented Apr 18, 2020

Includes koreader/crengine#337 :

  • Fix a few clang-tidy warnings
  • Add support for <img src="data:image/png;base64,...> - Closes Base64 encoded image in not displayed  #5529.
  • XML parsing: add more HTML5 named entities, optimize search
  • Text: fix standalone BR not making an empty line
  • Fix BR with "display: block" not making an empty line
  • Fix hyphens from soft-hyphens not part of highlighted segments
  • Use libunibreak for line breaking
  • Adds TextLangMan for text typography by language
  • Force BR to always be display:inline Force BR to always be display:inline crengine#338

Tweak ReaderHyphenation to work with the new TextLangMan (even if it will be replaced soon by ReaderTypography).
(Removed uneeded onUpdateToc() which were useless as they were done before the new rendering - another one was done elsewhere after the re-rendering)

This is just a bump to get a build with the new crengine code, which should still work with our current single global hyphenation language.


This change is Reviewable

@poire-z
Copy link
Contributor Author

poire-z commented Apr 18, 2020

Mhhh, noticable change with leaves.epub because of the <BR style="display:block/> handling change:

Source is:

<div xml:space="preserve" class="pgmonospaced">  You who celebrate bygones,<br class="calibre1"/>  Who have explored the outward, the surfaces of the races, the life<br class="calibre1"/>      that has exhibited itself,<br class="calibre1"/>  Who have treated of man as the creature of politics, aggregates,<br class="calibre1"/>      rulers and priests,<br class="calibre1"/>  I, habitan of the Alleghanies

with
.calibre1 { display: block }

KOReader before on the left / with this PR on the right:

image

Calibre and Firefox show it as:

image

while KOReader now adds an empty line.

Although logically, if it's a block element met inside a inline context, it should break the inline context to be displayed as a block and ensure its height.

So, may be it's not as simple as A or B in koreader/crengine#172 (comment) - although A would behave correctly.

Text case:

<p>abc
<br style="display: block"/>
def</p>

Includes:
- Fix a few clang-tidy warnings
- Add support for <img src="data:image/png;base64,...>
- XML parsing: add more HTML5 named entities, optimize search
- Text: fix standalone BR not making an empty line
- Fix BR with "display: block" not making an empty line
- Fix hyphens from soft-hyphens not part of highlighted segments
- Use libunibreak for line breaking
- Adds TextLangMan for text typography by language

Tweak ReaderHyphenation to work with the new TextLangMan
(even if it will be replaced soon by ReaderTypography).
@poire-z
Copy link
Contributor Author

poire-z commented Apr 19, 2020

OK, so still some differences with leaves.epub, but this time, it's for the best: some previously discarded BRs now generate empty lines:
Before | After:

image

image

And above page displays now as Firefox & Calibre:
image

So, updating unit tests...

@poire-z
Copy link
Contributor Author

poire-z commented Apr 19, 2020

Just some note about leaves.epub: the links from the KOReader TOC work fine - while the links from the in-book TOC (below "CONTENTS" in the screenshots above) target some id at the bottom of the previous poem.

[some poem]
<p class="calibre2"><a id="link2H_4_0007"><!--  H2 anchor --></a></p> <!-- id of the next poem -->
<div class="c2"><br class="calibre1"/>
<br class="calibre1"/>
<br class="calibre1"/>
<br class="calibre1"/></div>
</body></html>

[ next poem in a new DocFragment <body><html>...]

As each are in a DocFragment, we make a new page for each poem, so the link target is the bottom of the previous poem.
An ebook/publisher issue, not a KOReader one.
(Problem solvable with Style tweaks > Pages > Page break and blank pages > Avoid blank page on chapter end to remove our page break on each DocFragment, which I guess the publisher did not expect us to do)

@poire-z poire-z merged commit 6336927 into koreader:master Apr 19, 2020
@poire-z poire-z deleted the bump_crengine branch April 19, 2020 11:53
@Frenzie Frenzie added this to the 2020.05 milestone Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Base64 encoded image in not displayed
2 participants