Commit Graph

523 Commits (master)

Author SHA1 Message Date
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
2 weeks ago
Bastian Wagner aaa56a814f
CreDocument: support added 'identifier' metadata (#11628)
Currently not exposed in Book information.
3 weeks ago
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.
2 months ago
hius07 db2336440f
Alt status bar: custom metadata support (#11463) 2 months ago
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.
2 months ago
hius07 b8090c641c
Minimize DocSettings:open() calls (#11437) 3 months ago
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).
3 months ago
hius07 0ceb88a9a3
Fulltext search: all entries in entire document (#11313) 3 months ago
hius07 f765fe3070
Screenshot: set as book custom cover (#11227) 4 months ago
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
5 months ago
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.
6 months ago
hius07 b70f866656
DocSettings (again) (#11020)
Cleaning and optimizing Docsettings code.
6 months ago
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.
6 months ago
François Gannaz 11083022b0
Minor code quality improvements (#10905) 7 months ago
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.
7 months ago
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.
7 months ago
hius07 73378cd9d7
copt deduplicate: line_spacing (#10768) 8 months ago
hius07 f46f341b9b
Reset settings/cover/metadata separately (#10866) 8 months ago
hius07 a767ad44db
PDF contrast: incorrect set by a gesture (#10798) 8 months ago
hius07 1ef7821b66
getProps: centralize 2 (#10837)
Centralize and optimize handling document properties.
8 months ago
poire-z 626864f856 [chore] replace utf8 bytes with Unicode escape sequence 9 months ago
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.
9 months ago
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.
10 months ago
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)
10 months ago
hius07 1d4e256c82
credocument: epub alternative mimetype (#10575)
Used by Flibusta OPDS.
11 months ago
hius07 46933035c5
Open with: images (#10561) 11 months ago
hius07 46578c0e12
documentregistry: fix DocSettings (#10478) 11 months ago
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.
11 months ago
hius07 3dce41269d
Translator: translate current page (#10438) 12 months ago
poire-z 3006348585 PageBrowser: toggle page bookmark with long-press on thumbnail 1 year ago
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.
1 year ago
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.
1 year ago
poire-z c8616f1f35 CreDocument: enable crengine cache with smaller documents 1 year ago
hius07 cd56dd2edf
ReaderHighlight: pdf multi-page highlights (#9850) 1 year ago
weijiuqiao edf7cc9a61
Vocabulary builder: support extracting context from pdfs (#9622)
Move getSelectedWordContext(), now document specific,
from ReaderHighlight into each document module.
2 years ago
NiLuJe fadee1f5dc
Clarify our OOP semantics across the codebase (#9586)
Basically:

* Use `extend` for class definitions
* Use `new` for object instantiations

That includes some minor code cleanups along the way:

* Updated `Widget`'s docs to make the semantics clearer.
* Removed `should_restrict_JIT` (it's been dead code since https://github.com/koreader/android-luajit-launcher/pull/283)
* Minor refactoring of LuaSettings/LuaData/LuaDefaults/DocSettings to behave (mostly, they are instantiated via `open` instead of `new`) like everything else and handle inheritance properly (i.e., DocSettings is now a proper LuaSettings subclass).
* Default to `WidgetContainer` instead of `InputContainer` for stuff that doesn't actually setup key/gesture events.
* Ditto for explicit `*Listener` only classes, make sure they're based on `EventListener` instead of something uselessly fancier.
* Unless absolutely necessary, do not store references in class objects, ever; only values. Instead, always store references in instances, to avoid both sneaky inheritance issues, and sneaky GC pinning of stale references.
  * ReaderUI: Fix one such issue with its `active_widgets` array, with critical implications, as it essentially pinned *all* of ReaderUI's modules, including their reference to the `Document` instance (i.e., that was a big-ass leak).
* Terminal: Make sure the shell is killed on plugin teardown.
* InputText: Fix Home/End/Del physical keys to behave sensibly.
* InputContainer/WidgetContainer: If necessary, compute self.dimen at paintTo time (previously, only InputContainers did, which might have had something to do with random widgets unconcerned about input using it as a baseclass instead of WidgetContainer...).
* OverlapGroup: Compute self.dimen at *init* time, because for some reason it needs to do that, but do it directly in OverlapGroup instead of going through a weird WidgetContainer method that it was the sole user of.
* ReaderCropping: Under no circumstances should a Document instance member (here, self.bbox) risk being `nil`ed!
* Kobo: Minor code cleanups.
2 years ago
poire-z 3bd27c3a76 ReaderFont: add "Font-family fonts" submenu
Allow associating a font to each of the generic
font-family names.

Bump crengine:
- CSS parsing: accept (and ignore) namesspaces
- isImage(): more checks for <object> as it can have inner content
- getFontFileNameAndFaceIndex(): returns if font has math support
- getFontFileNameAndFaceIndex(): returns if font has emojis
- CSS/Fonts: add support for font-family to font name mapping
2 years ago
NiLuJe 2420557085
DocCache: Unbreak on !Linux platforms (#9566)
Regression since #9529
Fix #9565
2 years ago
NiLuJe 62059f8d68
Misc: Get rid of the legacy defaults.lua globals (#9546)
* This removes support for the following deprecated constants: `DTAP_ZONE_FLIPPING`, `DTAP_ZONE_BOOKMARK`, `DCREREADER_CONFIG_DEFAULT_FONT_GAMMA`
* The "Advanced settings" panel now highlights modified values in bold (think about:config in Firefox ;)).
* LuaData: Isolate global table lookup shenanigans, and fix a few issues in unused-in-prod codepaths.
* CodeStyle: Require module locals for Lua/C modules, too.
* ScreenSaver: Actually garbage collect our widget on close (ScreenSaver itself is not an instantiated object).
* DateTimeWidget: Code cleanups to ensure child widgets can be GC'ed.
2 years ago
NiLuJe 38919c22eb
ImageViewer: Clamp zoom factor to sane values (#9529)
Should avoid egregious values that would potentially alloc insanely large buffers (and likely fail to do so).

In the process, tweak the scale_factor computations when zooming so as to produce slightly less annoying behavior.
2 years ago
NiLuJe 13e8213e0a
A random assortment of fixes (#9513)
* Android: Make sure sdcv can find the STL
* DocCache: Be less greedy when serializing to disk, and only do that for the *current* document ;).
* CanvasContext: Explicitly document API quirks.
* Fontlist: Switch the on-disk Persist format to zstd (it's ever so slightly faster).
* Bump base for https://github.com/koreader/koreader-base/pull/1515 (fix #9506)
2 years ago
poire-z 76a7d83079 CRE/ImageViewer: get scaled blitbuffer when long-press on SVG
Get a Lua userdata wrapping a crengine LVSvgImageSource object
when long-press on a SVG image, and have crengine/LunaSVG render
it smoothly scaled to the requested size by ImageViewer.
2 years ago
poire-z 1c44c4c584 bump crengine: better SVG support with extended LunaSVG
Build crengine against LunaSVG instead of NanoSVG.
Includes:
- SerialBuf: allow serializing longer strings
- Support '<img src="data:image/svg+xml,<svg...', remove ;-cr-plain,
- CSS: attribute selectors: accept ' or " as the quote char
- Embedded fonts: fix ignored name when sharing same url
- LVImg: fix possible crash on GIF images
- Fonts: DrawTextString(): allow collecting glyphs as SVG paths
- Images parsing: cache native sizes
- SVG: enhanced SVG support with LunaSVG extended
- Add ldomNode::isImage(), handle <object> and <embed> as images
- Handle the <svg> element as an SVG image
- Support SVG images as first class documents

Make credocument the preferred engine for .svg files.
2 years ago
poire-z 55c0fc6190
CanvasContext.hasEinkScreen(): avoid crash on Android (#9417)
It is used by CoverBrowser, in a subprocess, when extracting
metadata from PicDocuments, and crash on Android as calling
android methods is only allowed from the main thread.
2 years ago
poire-z 9cba1904ee
CRe, MuPDF, PicDocument: add support for WebP images (#9402)
Bump base, includes:
- thirdparty/luasec 1.2.0
- Bump NanoSVG: various small fixes
- Add thirdparty/libwebp and ffi/webp.lua wrapper
- MuPDF: add support for webp images
- bump crengine: add support for webp images
- thirdparty/harfbuzz 5.1.0
RenderImage:renderImageData(): render webp images
with ffi/webp.lua.
2 years ago
poire-z 5e2ed5ae2a
bump crengine: monospace and fallback fonts tweaks (#9343)
Includes:
- Text: fix possible overflow with "white-space: pre"
- Fonts: getFontFileNameAndFaceIndex(): return family type
- Fonts: account for _bias in Font hash
- epub.css, fb2.css: remove hardcoded monospace font names
- Fonts: allow scaling monospace fonts
- Fonts: allow adjusting fallback font sizes to x-height
- HTML parser: trust xml encoding before html charset

In our list of fonts, show a "M" indicator alongside
monospace fonts, and allow long-press to select the one
to be use for "font-family: monospace".
Add 2 options to Font settings, to scale monospace fonts
by a percentage, and to adjust fallback fonts to their
x-height.
2 years ago
poire-z cc185bae4e Embedded fonts toggle: disabled if no embedded font
Have the enabled/disabled state of the toggle show the
presence or not of embedded fonts in the current book.
Also show the names of the embedded fonts in the
help_text InfoMessage.
2 years ago
poire-z b9724f1e93 Text highlighting: extend to include punctuations
When selected text seems to be a "sentence segment"
(that is, when there are punctuations around start
AND end), extend the selection to include the relevant
punctuation.
Do this only when saving highlights and for translation
(but not when dict or wikipedia lookups, or search).
2 years ago
NiLuJe dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
2 years ago
poire-z c825d50c8f CRE: add "CJK width scaling" option
The setting is handled like all other bottom menu options
but, as it's really not useful and its target audience is
very limited, make it not shown in the bottom menu, but
available via another button in the (also quite not useful)
Word Expansion fine tuning widget.
2 years ago