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

FR: Set font size in MuPDF EPUB rendering #4368

Closed
Frenzie opened this issue Nov 28, 2018 · 3 comments · Fixed by #5282
Closed

FR: Set font size in MuPDF EPUB rendering #4368

Frenzie opened this issue Nov 28, 2018 · 3 comments · Fixed by #5282
Assignees
Labels
Milestone

Comments

@Frenzie
Copy link
Member

Frenzie commented Nov 28, 2018

  • KOReader version: v2018.11.1
  • Device: all

Issue

You can't easily adjust the font size in a MuPDF-rendered EPUB. See https://www.mobileread.com/forums/showthread.php?p=3780029#post3780029

(Tracking here so I'm less likely to forget when I have some time, and to alert potentially interested parties like @poire-z @robert00s @pazos maybe @NiLuJe ?)

It's actually very easy to tap into the backend. This works:

diff --git a/frontend/document/pdfdocument.lua b/frontend/document/pdfdocument.lua
index 34f072e9..14ae115d 100644
--- a/frontend/document/pdfdocument.lua
+++ b/frontend/document/pdfdocument.lua
@@ -42,6 +42,8 @@ function PdfDocument:init()
     if not ok then
         error(self._document)  -- will contain error message
     end
+    local Screen = Device.screen
+    self._document:layoutDocument(Screen:getWidth(), Screen:getHeight(), 50)
     self.is_open = true
     self.info.has_pages = true
     self.info.configurable = true

What isn't as easy, or at least what would take some time to properly implement, is to make that not a hack, to make it properly configurable and and finally to tie it into the existing font size GUI.

@poire-z
Copy link
Contributor

poire-z commented Nov 28, 2018

(I'm a bit too busy with credocument these days to give much thoughts to pdfdocument :| )

But we could as a quick solution, if we can detect it's an epub-like document, call the above hack with the credocument default font size - so one can at least set it there to use it with MuPDF.

Otherwise, it indeed does not look obvious (ReaderView:onFontSizeUpdate() which gets the event when font size is changed, calls onReZoom... :| it's all quite tied to kopt...

@pazos
Copy link
Member

pazos commented Nov 28, 2018

What benefits does Mupdf have over crengine to render epub files?. I find crengine quite powerful for reading epubs.

@Frenzie
Copy link
Member Author

Frenzie commented Nov 29, 2018

A concrete advantage is RTL. A document in Hebrew etc. will look mostly or even entirely correct in MuPDF right now.

Mostly it's just something different. But MuPDF is actively developed upstream, so if they implement brilliant support for X in the future we'll get it (almost) for free.

There's also some font size shenanigans in cr I still have to track down.

Frenzie added a commit to Frenzie/koreader that referenced this issue Dec 2, 2018
Makes an attempt at a reasonable default. References koreader#4368.
Frenzie added a commit that referenced this issue Dec 2, 2018
Makes an attempt at a reasonable default. References #4368.
Frenzie added a commit to Frenzie/koreader-base that referenced this issue Aug 29, 2019
This will be queried in front to dynamically set font size.

Cf. <koreader/koreader#4368>.
Frenzie added a commit to koreader/koreader-base that referenced this issue Aug 29, 2019
This will be queried in front to dynamically set font size.

Cf. <koreader/koreader#4368>.
Frenzie added a commit to Frenzie/koreader that referenced this issue Aug 29, 2019
@Frenzie Frenzie added this to the 2019.09 milestone Aug 29, 2019
@Frenzie Frenzie self-assigned this Aug 29, 2019
Frenzie added a commit that referenced this issue Aug 29, 2019
Frenzie added a commit that referenced this issue Aug 30, 2019
mwoz123 pushed a commit to mwoz123/koreader that referenced this issue Mar 29, 2020
mwoz123 pushed a commit to mwoz123/koreader that referenced this issue Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants