Commit Graph

107 Commits (ce624be8b83e880b1a81106a143e1440eeda4aab)

Author SHA1 Message Date
NiLuJe ce624be8b8 Cache: Fix a whole lot of things.
* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
3 years ago
Martín Fernández 40b4ccffa8
KoptInterface:getWordFromBoxes: guard against nil boxes (#6827)
Fixes #6825
3 years ago
Galunid 15455b594d
[feat] Comics: zoom to panel (#6511)
This pull requests aims to provide convenient way to zoom in comics. The idea is when user holds/double taps (not decided yet) on a manga/comic panel, it gets cut out from the rest of the image and zoomed. More details in koreader/koreader-base#1148. Depends on koreader/koreader-base#1159
4 years ago
Martín Fernández d87b09d11c
handle newlines in exported pdf highlights (#6247) 4 years ago
Frans de Jonge b2554ba5da
[fix] Prevent crash when no page boxes (#5289)
Can occur with invalid page numbers, for example by changing the font size in a reflowable MuPDF document.

Discussion in <https://github.com/koreader/koreader/pull/5282#issuecomment-526842921>.
5 years ago
Frans de Jonge bc2412a67a
[doc] Convert koptinterface comments to LDoc format (#5290) 5 years ago
poire-z 5c38bcb8b7 [UX] Links menu and handling tweaks (#4867)
- Removed "Swipe to follow first link on page" menu item and
  handling code, as it feels not really as practical as
  "Swipe to follow nearest link".
- Removed recently added "External link action", as we can
  just always present a popup with the url and the available
  actions.
- Generic handling of these actions in onGoToExternalLink(),
  so they are proposed on the Wikipedia lookup popup too.
- Allow external link on PDF documents (previously, only
  internal links were handled).
- Have "Ignore external links on tap" available on all
  document types.
- Added "Ignore external links on swipe" (default to true,
  the current behaviour).
- Added multiswipe gesture "Follow nearest internal link"
  (the existing "Follow nearest link" now follows the
  nearest external or internal link)
- ButtonDialogTitle: added an option to look a bit more
  alike ConfirmBoxes.
- Footnote popups: fix link unhighlight when tap on external link.
5 years ago
Qingping Hou 1605409c60 rename runtimectl to document/canvascontext 5 years ago
Qingping Hou 8513778990 decouple device from koptinterface 5 years ago
Qingping Hou 9e57e56f95 decouple UI definitions from document modules 5 years ago
Frans de Jonge 076bf406fd
[UX] Add InfoMessage about OCR (#3718) 6 years ago
Frans de Jonge fa12f488e8 Fix garbled ImageWidget cache issues
Fixes #2805. Thanks to @poire-z, see https://github.com/koreader/koreader/issues/2805#issuecomment-296686695
7 years ago
poire-z 76f6b49731 Fix crash with kopt semi-auto crop on blank page
When such blank page has only a few black pixels (dust), it would result in
a really small cropped area, than when scaled to fit screen, would cause a
crash with :
    ./ffi/mupdf.lua:63: could not allocate pixmap:
         malloc of array (451342 x 612558 bytes) failed (integer overflow) (1)
Fix similar to what is done in KoptInterface:getAutoBBox(): when cropped area too small,
fall back to whole page (or here: to user's manually set area).
7 years ago
Qingping Hou f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 7 years ago
chrox 551857ce6e fix some luacheck warnings 8 years ago
Qingping Hou fe6aaca47d Merge pull request #2083 from chrox/fix_2060
fix #2060 by handling blank search pattern
8 years ago
chrox 5bbcae954e fix #2060 by handling blank search pattern 8 years ago
chrox 5983050d79 PDF free zoom mode revisit
this should implement feature request of zoom mode for multi-columns
page in #501
This PR depends on koreader/koreader-base#435

How to use?
1. Tap the top left corner of a PDF/Djvu page to get into the flipping
mode
2. Double-tap on text block will zoom in to that column
3. Double-tap on any area will zoom out to an overview of the page
4. repeat step 2 to focus to another page block

How does it work?
1. We first find the mask of text blocks in the page. (Pic 1)
2. Then we intersect page boxes with user tap to form a page block. (Pic 2)
3. Finally we zoom the page to the page block and center current view to
that block. (Pic 3)
8 years ago
Qingping Hou e422842256 minor: a lot of luacheck fixes 8 years ago
chrox 54f5166254 add koptinterface spec 9 years ago
chrox f73f8916c0 fix #1569 use fit to page zoom cover image even in reflow mode 9 years ago
chrox 34ea9ac574 add datastorage module to handle data directory on various platform
On kindle, kobo and pocketbook the data directory is the current
running directory but on Android the app is installed in system
defined location and users may have no access to that location.
The same circumstances should be true for the upcoming Koreader for
Ubuntu touch, so the data directory (in which tessdata, dictionaries,
global settings, persistant defaults and probably history data are
stored) could be stored in another place.
9 years ago
chrox c2924abac4 Fix OCR fails on native djvu pages
The page_width and page_height were always 600 and 800 before this patch
rendering the OCR engine confused.

This should fix #1379.
9 years ago
Hans-Werner Hilse 22697adf20 switch from scaleByDPI() to scaleBySize() 9 years ago
Hans-Werner Hilse f9f97163e8 wait for background thread before free()ing koptcontext
This should prevent freeing resources that are actually in use in
a background thread.
9 years ago
chrox b80dd1f966 add fulltext search for PDF documents 9 years ago
Hans-Werner Hilse 3066c86e38 Refactoring hardware abstraction
This is a major overhaul of the hardware abstraction layer.
A few notes:

General platform distinction happens in
  frontend/device.lua
which will delegate everything else to
  frontend/device/<platform_name>/device.lua
which should extend
  frontend/device/generic/device.lua

Screen handling is implemented in
  frontend/device/screen.lua
which includes the *functionality* to support device specifics.
Actually setting up the device specific functionality, however,
is done in the device specific setup code in the relevant
device.lua file.

The same goes for input handling.
10 years ago
chrox 8c9751744e fix #1064 by adding timestamp of document in cache key
so that when document is modified the persistent cache will
be invalidated automatically because the cache key will not
be matched. There is no perfermance overhead here at all. We
even don't need to check the modification time of the cache item
on disk, because the name of the on disk cache is a md5sum of the
cacheitem key, now the filename of the cache files contains the
modification time information.
If the document is modified since one rendered page is cached to disk,
the cache key won't match the cache file. And the cache file will
be discarded without the need to open the cache file or to check
the modification time of the cache file itself.
10 years ago
chrox 0bc3eadcae refactoring: use Document API getCoverPageImage to get cover image 10 years ago
chrox 120f18737e add advanced option forced_ocr to force ocring text 10 years ago
chrox f507fd3709 various Android fix
now the android build has nearly the same features as the
Kindle/Kobo build. It's time for Android nightly build?
10 years ago
chrox 55734f6aaa export highlighted rect in scanned page to Evernote 10 years ago
chrox e1527611c5 show a box indicator when tapping on a link
only for PDF/DJVU docs for now since there is no easy way
to get link box from crengine
10 years ago
chrox 775e5ea3b4 serialize the most recently used blitbuffer/koptcontext
to speedup koreader startup for PDF/DJVU documents
especially when reflowing
10 years ago
chrox c6c4cbcab1 add dewatermark option for pdf/djvu documents 10 years ago
chrox 92219a1f1e cleanup: expand tab to 4 spaces 10 years ago
chrox 22c437c393 fix init koptcontext with all zero bbox 10 years ago
chrox d24d5e413e add following page link in reflowed page 10 years ago
Paulo Matias dacd3d2acb Fix crash trying to select text in an empty page 10 years ago
chrox eaa9535133 move logMemoryUsage from koptinterface to document 10 years ago
chrox 8e4516b824 add regional zoom mode in pdf/djvu page
In regional zoom mode double tap will zoom to the tapped
region(paragraph or column, etc., detected optically via libk2pdfopt).
As the first demo, this feature is only turned on in flipping mode by
tapping the top-left corner of the screen. Eventually we may incorporate
this feature in "free" zoom mode.
10 years ago
chrox 62e12ddfba import document module on-demand 10 years ago
chrox 7247a9e3a2 add writing direction option when reflowing
This probably will fix #195.
10 years ago
chrox 2fd66e1fa3 typo fix 10 years ago
chrox 84ad0f2307 fix null export highlight in reflowed mode 10 years ago
chrox 71cb2d3f93 fix looking up wrong word in reflowed page
that has a text layer underneath.

For multi-column page reflowing usually fits individual column to
page width and no finner word boxes are available to map reflowed
word box onto native word box. Now the relative position of a reflowed
word center is calculated as portion of the width and height of a larger
block it belongs. This relative position is also considered in
reflow-to-native position transform so that dictionary lookup now works
on multi-column pages in reflowing mode.

This should fix #376.
10 years ago
chrox 5bf56cbf4c check position nullity in getTextFromBoxes 11 years ago
chrox 2590cc7ca5 highlight text from scratch instead of reusing rectmaps in reflowing mode 11 years ago
chrox 184a6f5d21 highlight word from scratch instead of reusing rectmaps in reflowing mode
Totally revert the OCR in reflowed page to build 545.
And this should fix #309.
11 years ago
chrox 90d55cbde4 set auto detect word gap in reflowing by default 11 years ago