2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00
Commit Graph

540 Commits

Author SHA1 Message Date
NiLuJe
46a5d20513
Document: Do not cache panel-zoom tiles to disk and fix their caching and rendering (#12303)
* Use a dedicated cache hash for partial tiles from panel-zoom
* Never dump them to disk, as it confuses DocCache's crappy heuristics that rewinds the cache to skip over the hinted page to try to dump the on-screen page to disk.
* Apply the zoom factor in the exact same way as any other page rect (i.e., floor coordinates, ceil dimensions), and make sure said rect is actually a Geom so it doesn't break the cache hash, which relies on Geom's custom tostring method for rects. Said scaling method *also* belongs to the Geom class anyway.
* Handle such pre-scaled rects properly in renderPage, so as not to apply the zoom factor to the full page, which would attempt to create a gigantic buffer.
* And now that the rect is rendered properly in an appropriately-sized buffer, use the rendered tile as-is, no need to blit it to another (potentially way too large because of the above issue) blank BB.
* The zoom factor is now computed for a scale to best-fit (honoring `imageviewer_rotate_auto_for_best_fit`), ensuring the best efficiency (ImageViewer won't have to re-scale).
* Cache: Reduce the maximum item size to 50% of the cache, instead of 75%.
* Warn about the legacy ReaderRotation module, as it turned out to be horribly broken. The whole machinery (which is spread over *a lot* of various codepaths) is left as-is, peppered with notes & fixmes hinting at the problem. Thankfully, that's not how we actually handle rotation, so it was probably hardly ever used (which possibly explains why nobody ever noticed it breaking, and that nugget possibly dates back to the inception of the kpv -> ko refactor!). (#12309)
2024-08-08 04:52:24 +02:00
hius07
975efae929
ReaderSearch: "All text" improve (#12287) 2024-08-06 19:12:16 +03:00
Frédéric Brière
9e6f3dac65
Panel zoom: Properly handle renderPage() not rendering the whole page (#12296)
When zooming to a small panel on a device with a large display, the
resulting zoom factor often causes `renderPage()` to only render the
panel itself instead of the whole page.  `getPagePart()` needs to
account for that when extracting the panel from the rendered tile.

Fixes half of #7961 (namely the black/half-black rectangles)
2024-08-05 22:47:51 +02:00
poire-z
949b996ad7
Fix early unhighlight after Add to vocab builder (#12288)
Getting text from xpointers to get the current selected
word context would have crengine unhighlight that word.
Allow to get it selected again when done getting context.
2024-08-04 23:27:30 +02:00
poire-z
caaf789052
CRE call cache: don't wrap setViewMode (#12194)
Avoid highlights' xpointers to be recomputed when
switching between page and scroll mode, which could
make using "Auto-scroll when selection reaches a corner"
really slow when having a large number of highlights.

Closes #12156.
2024-07-20 21:16:32 +02:00
Benoit Pierre
99d45d7584 djvu: honor render mode when reflowing 2024-07-19 21:32:20 +02:00
Benoit Pierre
0c17941ffb kopt: color support
Keep colors when reflowing documents.
2024-07-19 21:32:20 +02:00
Benoit Pierre
cb002f3d1f kopt: fix bad KoptInterface:renderPage call
Fix `render_mode` argument: add missing `gamma` argument.
2024-07-19 21:32:20 +02:00
poire-z
7ef3e475cb
CRE call cache: don't reset on setPageInfoOverride (#12123)
Fix slowness when top status bar enabled on books
with a large number of highlights.
2024-06-29 17:15:45 +02:00
Frans de Jonge
f2691b833e MuPDF: add mobi filetype 2024-06-02 08:14:34 +02:00
Frans de Jonge
b46f03f092 [minor] Fix typo in XLSX
Dumb typo in #11955.
2024-06-02 08:14:34 +02:00
Frans de Jonge
8960f3d478
MuPDF: add txt, cfb, docx, xslx, pptx filetypes (#11955)
New in 1.24.0. See <https://mupdf.com/releases/history>.

Possible due to <https://github.com/koreader/koreader/pull/11940>.
2024-06-01 22:22:29 +02:00
Benoit Pierre
99447414dc
mupdf: update to 1.24.2 (#11940)
Depends on https://github.com/koreader/koreader-base/pull/1805.

Closes:
- #5422 
- #9927
- #10879
2024-06-01 13:22:02 +02:00
Benoit Pierre
4c6919ac2a bump base: update tesseract, leptonica and libk2pdfopt
- update leptonica to 1.84.1
- update tesseract to 5.3.4
- update libk2pdfopt to 2.55
2024-06-01 09:56:36 +02:00
Benoit Pierre
10e6f489d0 kopt: honor TESSDATA_PREFIX environment variable
Don't override it by default, but honor it if present.
2024-06-01 09:56:36 +02:00
poire-z
40814bf12b
bump crengine: minor fixes (ruby, a crash, non-linear flows) (#11863)
Includes:
- html5.css: really ensure ruby centering
- getRenderedWidths(): fix possible crash with 0-width images
- Page splitting: ignore empty non-linear flows
- LvDocView header: allow overriding "page/total %"
CreDocument: add setPageInfoOverride() to allow tweaking
top status bar display of page number/count/% (to be
implemented in a later commit).
2024-05-20 23:38:53 +02:00
Galunid
ca14420372
Add relevant nil guards to prevent reflow crashes (#11715)
closes #10854 #9272 #4481
2024-04-27 23:16:13 +02:00
poire-z
d178273671
bump base, luajit-launcher, avoid assert failure in sub-processes (#11658)
Bump base:
- Update LuaJIT to 20240310
- harfbuzz: fix ccache 4.9.1 errors
- ci: drop unnecessary macOS build dependency
- CRE: avoid assert failure in sub-processes
Bump luajit-launcher:
- Update LuaJIT to 20240310
Frontend:
- CreDocument: prevent assert failure in sub-processes
2024-04-10 22:39:59 +02:00
Bastian Wagner
aaa56a814f
CreDocument: support added 'identifier' metadata (#11628)
Currently not exposed in Book information.
2024-04-08 04:17:41 +02:00
poire-z
9467034f3f ReaderTypeset: tweak Style> menu logic and defaults
- Reword and document most menu items.
- Handle internally two default styles, one applying only
  to FB2/FB2 books, and the other to all other formats.
- Also don't reset the stylesheet to epub.css when
  toggling Embedded Styles to off.
2024-03-10 17:06:14 +01:00
hius07
db2336440f
Alt status bar: custom metadata support (#11463) 2024-02-18 08:06:50 +02:00
hius07
5d4747c593
FileManager: less lfs calls (#11452)
Use item info provided by FileChooser.
Also fix showing PathChooser with invalid path,
and fix issue when opening non-supported files.
2024-02-17 01:17:59 +01:00
hius07
b8090c641c
Minimize DocSettings:open() calls (#11437) 2024-02-07 10:35:52 +02:00
poire-z
43d36b2ea9 TextBoxWidget: allow showing bits of text in bold
Allow for embedding "tags" (invalid Unicode codepoints)
in the text string to trigger some text formatting:
for now only bolding some parts of text is possible.

Use it with fulltext search "all results" to highlight the
matched word (instead of the previously used brackets).
2024-01-18 12:51:10 +01:00
hius07
0ceb88a9a3
Fulltext search: all entries in entire document (#11313) 2024-01-13 12:58:05 +02:00
hius07
f765fe3070
Screenshot: set as book custom cover (#11227) 2023-12-16 10:36:57 +02:00
NiLuJe
82e7ebd6df
ReaderView: Flash when paging *away* from images, too (#11152)
Reword the `Always flash around pages with images` Menu/Dispatcher entry
accordingly.

Fix #11143
2023-11-26 05:51:47 +01:00
hius07
68aa209a6c
Open with... improvement (#11056)
Allows associating filetypes with non-document providers (like ImageViewer or TextViewer) to "open" (view) these files by a tap in file browser.
2023-11-05 07:24:18 +02:00
hius07
b70f866656
DocSettings (again) (#11020)
Cleaning and optimizing Docsettings code.
2023-10-31 07:30:39 +02:00
hius07
2ed2c2c23d
md5: centralize and deduplicate (#11003)
Document partial md5 hash is calculated by util.partialMD5() and stored in doc_settings as "partial_md5_checksum" on the first document opening.
2023-10-15 07:47:09 +03:00
François Gannaz
11083022b0
Minor code quality improvements (#10905) 2023-10-12 14:52:11 +02:00
Ryan W West
27104ea011
Add hash-based document metadata storage option (#10945)
This option saves metadata sidecar (sdr) directories not next to the book or in koreader/docsettings/, but in koreader/hashdocsettings/ using the partial md5 hash of each documents, allowing users to move, rename, and copy their documents outside of KOReader without accidentally losing their highlights/notes/progress. Included are various warnings and info to users of the benefits and drawbacks of this non-default option.

Closes #10892.
2023-10-11 10:39:33 +02:00
poire-z
e6ac74c1df ReaderPaging: use document:getNext/PrevPage()
instead of doing arithmetic (ie. new_page=cur_page+1).
This makes it ready to work with custom hidden flows
where these document:getNextPage()/getPrevPage() will
be overloaded to skip pages in hidden flows.

Also fix some odd issues (page truncated or with parts
duplicated) with scrolling/page turning when at start
or end of the document.
2023-10-09 00:15:05 +02:00
hius07
73378cd9d7
copt deduplicate: line_spacing (#10768) 2023-09-08 08:40:47 +03:00
hius07
f46f341b9b
Reset settings/cover/metadata separately (#10866) 2023-09-05 07:42:46 +03:00
hius07
a767ad44db
PDF contrast: incorrect set by a gesture (#10798) 2023-09-02 09:41:27 +03:00
hius07
1ef7821b66
getProps: centralize 2 (#10837)
Centralize and optimize handling document properties.
2023-08-30 07:53:59 +03:00
poire-z
626864f856 [chore] replace utf8 bytes with Unicode escape sequence 2023-08-02 01:28:24 +02:00
poire-z
eecdac930e View HTML: Show matched rules: ignore style & tweaks on long-press
On long-press on the "Show matched stylesheets rules"
buttons, ignore those from our epub.css/html5.css and
from styletweaks, which may make investigating a book
style simpler without their noise.
2023-07-26 01:05:15 +02:00
poire-z
8a240dd635
bump LunaSVG, crengine: add support for .docm (#10702)
Includes:
- bump LunaSVG: intermediate upstream bump, cleanup
- bump LunaSVG: minor upstream tweaks
crengine:
- DocX: add support for similar DocM format
- LVStyleSheet: fix LVCssDeclaration::getHash()
- CSS parsing: accept Unicode values for ID and classnames
- update for Harfbuzz 8, fix some compiler warning
Also fix input not restored when loading failed,
and KOReader not able to exit.
2023-07-16 19:18:10 +02:00
poire-z
a4720b44cd Text search: various Kopt search fixes
- Properly parse input text for words (the previous
  code wasn't working with Greek letters)
- With multiple words search, don't allow "substring
  matching" for words in the middle
- Remove support for Lua pattens, so to get proper
  substring matching (as we have with cre text search)
2023-07-04 09:03:34 +02:00
hius07
1d4e256c82
credocument: epub alternative mimetype (#10575)
Used by Flibusta OPDS.
2023-06-13 12:16:36 +02:00
hius07
46933035c5
Open with: images (#10561) 2023-06-12 09:08:56 +03:00
hius07
46578c0e12
documentregistry: fix DocSettings (#10478) 2023-05-28 08:04:25 +03:00
hrdl
20101baef6
pdfdocument: cache page text (#10450)
Updating the selection queries the same page tens of times per second. This prevents KOReader from keeping up with high-frequency input event streams.

Fixes #10443. Relies on koreader/koreader-base#1612.
2023-05-18 22:08:50 +02:00
hius07
3dce41269d
Translator: translate current page (#10438) 2023-05-17 07:34:37 +03:00
poire-z
3006348585 PageBrowser: toggle page bookmark with long-press on thumbnail 2023-03-14 23:41:38 +01:00
poire-z
eeb3c08457 View HTML: add CSS helpers with long-press
Move View html code from ReaderHighlight to a new
dedicated module.
Long-press on an element or its text in the HTML will
show a popup with a list of selectors related to this
element that can be copied to clipboard (to be pasted
in Find or in a Book style tweak).
2 addtional buttons in this popup allow seeing all the
CSS rulesets in all stylesheets that would be matched by
this element, which should make it easier understanding
the publisher stylesheets and using or creating style
tweaks.
2023-03-05 23:42:24 +01:00
poire-z
81f2aed086 ReaderRolling: quicker partial rerenderings with EPUBs
Only available with EPUBs containing 2 or more fragments,
and a file size large enough to ensure a cache file is used.
The idea is simply, on any rendering setting change, to
skip the rerendering of the full book and to defer any
rerendering to the moment we draw a DocFragment, and
render only it.
So, on a setting change, only the fragment containing the
current page will be rerendered, and the new fragments we
may cross while turning pages.
When having done so, KOReader is in a degraded state (the
full page count is incorrect, the ToC is invalid...).
So, a full rerendering is needed, and one will happen
in the background, and when the user is idle, we reload
seamlessly and quickly from the cache file it has made.
ReaderFlipping will show some icons in the top left
corner to let it know at which steps in this procress
we are.
2023-02-16 23:36:26 +01:00
poire-z
c8616f1f35 CreDocument: enable crengine cache with smaller documents 2023-02-16 23:36:26 +01:00