2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

416 Commits

Author SHA1 Message Date
poire-z
dd74194e0a cre.getWordFromPosition(): fix a few issues
Drop the use of crengine's getWordFromPosition() which
is a bit unreliable: it may returns wrong coordinates,
or words from far away in the book (ie. when holding
in the margins).
Rely only on the robust getTextFromPositions() that
we already use for multi words selection.
Having good coordinates allows refreshing a smaller region
(the higlighted word, or the 2 lines if hyphenated).
2020-12-31 13:28:08 +01:00
NiLuJe
d80d6dc562 Handle the BlitBuffer struct changes
* stride is now a size_t
  On some platforms, that's 64 bits, which means it's no longer
  automatically converted to a Lua number to avoid precision loss.
  Do that ourselves, because lua-serialize doesn't know how to handle an
  uint64_t cdata ;).
2020-12-19 01:54:43 +01:00
jperon
8b7d60299f
JPG/PNG: MuPDF as default provider (#6931)
As said in #6929
2020-12-04 19:10:50 +01:00
jperon
8eeb010dc9
Paged documents: rework zoom options (#6885)
- Move zoom options from top menu to bottom config
- Add option to manually define zoom (relative to
  page width) and overlap (in percent)
- Add options to zoom to columns or rows, possibly
  with overlap. Add panning direction options when
  page forward in these modes
2020-11-28 17:18:57 +01:00
Jellby
5e3c554dd7 Hide non-linear fragments
Add option to hide (skip) non-linear fragments, only working
in 1-page mode. Tweaks mostly to footer, toc and skim code
to make it clear(er) which pages belong to linear or non-linear
fragments.
2020-11-18 18:28:47 +01:00
Jellby
f892d4559f Fix typos 2020-11-18 18:28:47 +01:00
yparitcher
edec69ac8b
[CRe] Tweak nightmode and CRe call cache interaction (#6859)
Simplify 4caf8f28 (#6854), allowing us not to track
nightmode in two places.
2020-11-08 22:55:11 +01:00
NiLuJe
4caf8f281d
[CRe] Ensure toggling nightmode invalidates the drawCurrentView cache (#6854)
* Use a CRe set* method when toggling nightmode

This ensures it gets flagged as add_reset by the call cache, and that
CRe will actually re-render, as it's necessary if nightmode_images is
enabled (the default).

Fix #6845

* Prevent ReaderHighlight:onTap from running ReaderHighlight:clear when
it's unnecessary.

Avoiding a clearSelection call in CRe that could invalidate the cache
and cause unnecessary redraws.

* Don't store empty highlight arrays when all HLs on a page have
been deleted
2020-11-08 02:18:50 +01:00
Martín Fernández
40b4ccffa8
KoptInterface:getWordFromBoxes: guard against nil boxes (#6827)
Fixes #6825
2020-10-26 12:26:18 +01:00
poire-z
8b886e5922
bump crengine: sync with upstream, new hyphenation languages (#6746)
Includes:
- (Upstream) various unimpacting changes to keep in sync
- (Upstream) Fix issues with legacy text rendering
- (Upstream) FB3/DocX/ODT: get lang and description metadata
- (Upstream) remove some global settings, make them per-doc
- TextLang, hyphenation: add Armenian, Friulian, Piedmontese,
  Romansh, Zulu and Brazilian Portuguese.

Also make cre the prefered engine for .xhtml (over MuPDF)
and for .xml (which might be HTML).
2020-10-03 15:07:07 +02:00
ezdiy
7a40b496fb
blitbuffer: fixups for base (#6714)
fixups for base bumped to https://github.com/koreader/koreader-base/pull/1201
otherwise tilecache breaks
2020-09-28 01:04:59 +02:00
Galunid
b297fb7cf6
Panel zoom - improve output image resolution (#6709) 2020-09-25 20:14:01 +02:00
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
2020-09-24 15:17:37 +02:00
poire-z
4d53ec76fe
bump crengine: ODT support, more typography languages (#6675)
Includes:
- Update German hyphenation patterns
- (Upstream) Adds ODT (ODF) format support
- TextLang, hyphenation: add Basque, Croatian, Esperanto,
  Estonian, Georgian, Latvian, Lithuanian, Macedonian,
  Occitan, Welsh; update Bulgarian, Irish, Portuguese,
  Slovak, Dutch, Norwegian, Spanish; update hyphen min
  for Czech, English, Greek; fix Romanian and Ukrainian
  pattern file names
- HyphMan: adds HyphMethod::getLeft/RightHyphenMin()
- epub.css: update HR default style
- fb2.css: keep <date> in main text left-aligned
- getRenderedWidths(): inline-block and table fixes
- CSS: avoid style hash mismatch when serializing content:''
- Tables: re-order row groups when necessary
- XML parsing: don't drop trailing text
- HTML parser: tweak implicit head/body insertion code
- Fix text search failure when blank at start or end

readertypography.lua: some cleanup by removing the first
table listing hyph dicts, and including their filenames
in the second table so we can build the first table
dynamically. Also fetch hyph left/right min limits from
crengine to not have to duplicate them here and keep them
in sync.
css_tweaks.lua: for in-page footnotes, switched from
"-cr-only-if: epub-document" to ": -fb2-document"
("not" FB2 documents), so these tweaks also work with
DocX and ODT footnotes.

Also included in base bump:
- KOPTContext: add comic panel detection function/additional
  leptonica declarations
- Forcibly disable docs when building giflib
2020-09-18 19:34:46 +02:00
NiLuJe
99045b4311
Minor util & ffi/util cleanups (#6657) 2020-09-15 20:39:32 +02:00
ezdiy
426f7b5ddc
Add API to set OS level file associations (#6615) 2020-09-01 16:39:47 +02:00
Martín Fdez
454ed0ebeb enable usage of system fonts 2020-08-27 21:40:18 +02:00
poire-z
8d99523388
bump crengine: new HTML parser, libRu and FB2 tweaks (#6560)
Includes:
- Revert "FB2: don't draw cover in scroll mode"
- (Upstream) FB2: fix coverpage drawing in scroll mode
- FB2 footnotes: only merge run-in when next is erm_final
- fb2.css: use OTF tabular-nums for footnote numbers
- Text: ignore ascii and unicode control chars
- Fix HR positionning when floats involved
- writeNodeEx(): minor tweaks
- OnTagClose(): add self_closing_tag parameter
- HTML format detection: accept HTML5 doctype
- HTML parser: rework Lib.ru specific handling
- HTML parser: new more conforming implementation
- HTML parser: ensure foster parenting inside tables

Also includes:
- SDL: don't bypass X11 WM compositor
2020-08-25 15:45:05 +02:00
Frans de Jonge
da507f8607
[chore] Update MD5 calls with new sha2 library (#6411)
Depends on <https://github.com/koreader/koreader-base/pull/1149>.
2020-07-21 23:25:46 +02:00
Martín Fernández
f9293a67b0
[fix] Remove isAllowedScript leftovers (#6366)
Fixes #6365
2020-07-09 18:11:56 +02:00
Martín Fernández
d87b09d11c
handle newlines in exported pdf highlights (#6247) 2020-06-09 17:07:51 +02:00
NiLuJe
64825eccd2
Update bundled fonts (#6242)
* Update bundled fonts

* Minor FreeFont update
* Noto Sans CJK downgrade to fix a number of issues w/ the git version
* Initial import of Noto Naskh Arabic

* Replace Noto Sans Arabic UI by Noto Naskh Arabic in the CRe fallback
list
2020-06-08 16:36:06 +02:00
poire-z
5536ce996a CRE: use same marks in top and bottom progress bars
Feed to crengine the same ticks (build from the TOC
entries) that we use in the bottom status bar.
(crengine otherwise builds a tick for each DocFragment,
which most often is really different than what's seen
in the bottom bar.)
2020-06-05 20:13:59 +02:00
poire-z
177551918f
bump_crengine: various fixes, tweaks and cleanups (#6188)
Includes:
- Don't reset invisible BR to display: inline
- ldomTextCollector: handle inline-block/table as inline
- Avoid re-rendering on font hinting mode change
- List markers: fix positionning when floats involved
- GIF decoding: avoid uneeded abort on LZW table overflow
- Adds getUnknownEntities(), can help with debugging
- Don't check stylesheet hashes when loading from cache
- Hardcoded elements and attributes list: cleanup
- Full rendering: 2 small optimisations
- Strut confinning: deal with images earlier
- lvtextfm: some cleanup and reordering
cre.cpp:
- fix getPageFromXPointer() and getPosFromXPointer()
  to not fail on invisible nodes and work on the next
  visible node (so links whose target is display:none
  can work).

Add support for 2 settings one can set manually
in reader.settings.reader.lua:
["cre_background_color"] = "0xccffcc",
["cre_background_image"] = "/path/to/bg_paper.jpg",
2020-05-25 22:39:59 +02:00
poire-z
e074b603e0 Adds Word Expansion: use of letter spacing for justification
Bump crengine:
- Text: fix occasional BiDi bad word splitting
- Font: fix HB fallback measurement/drawing mismatches
- Font: do not add letter spacing on diacritics
- Text: tunable use of letter spacing for justification
- Text: dont adjust space after initial quotation mark/dash (rework)
- Text: fix possible bad widths after collapsed spaces

xtext.cpp: pick crengine fix with HB fallback
measurement/drawing mismatches

Adds "Word Expansion" to bottom Font size menu, and moved
"Word Spacing" there too, to balance the panels' heights
to 4 items.
2020-05-05 19:06:28 +02:00
poire-z
1a91893576
Allow toggling use of additional fallback fonts (#6095) 2020-04-28 23:57:10 +02:00
poire-z
7d83a0c967
bump crengine: multiple fallback fonts (#6090)
Includes:
- Simplify libunibreak includes
- Text: fix read/write outside array bounds
- lvtextfm: dont adjust space after initial quotation mark/dash (rework)
- Fonts: allow providing and using multiple fallback fonts

Users can set their prefered fallback font, which will be completed
with a few of our shipped fonts for maximum coverage.
2020-04-25 20:20:41 +02:00
poire-z
6dc8bbcc49
Adds ReaderTypography (replaces ReaderHyphenation) (#6072)
Replace Hyphenation menu with Typography menu.
This works mostly like before:
- typography/hyphenation is chosen according to the book
  metadata language,
- one can set a default or a fallback language,
- hyphenation is now just a subset of typography, and
  can be disabled while still setting a language and
  enabling the other features,
- the typography language enables newly added features
  to crengine: per-language line breaking rules and
  per-language Harfbuzz glyph selection.
2020-04-21 21:30:16 +02:00
Martín Fdez
8e831eb756 desktop: disable battery on touch menu and reader footer
isDesktop and isEmulator are now different entities
2020-04-13 19:24:28 +02:00
Frans de Jonge
2945a2fb79
Add EPUB3 extension to MuPDF document (#6013)
Loads fine, see 026140f809 (commitcomment-38122799)
2020-03-29 14:38:07 +02:00
poire-z
026140f809 Adds ReaderPageMap, to optionally show source pages numbers
bump crengine: support for EPUB3 nav toc and page maps
Includes:
- Fix lvRect:isRectInside(rc) with 0-width or 0-height rect
- TOC: parse EPUB3 nav toc, fallback to spine when no toc
- Parse and cache various hardcopy page list maps
- epub.css: hide EPUB3 <span epub:type="pagebreak"> content
cre.cpp: add a few PageMap helper functions.

Adds ReaderPageMap which will add a new menu (under TOC and
Bookmarks) that will allow:
- to list source page numbers (like a TOC)
- to show visible page labels in the right margin
- to use these source page numbers in the footer, the TOC,
  the GoTo and SkimTo widgets, and to use the source page
  number in the standard bookmark and highlight initial text.
2020-03-27 18:36:48 +01:00
Frans de Jonge
c2aac0f71e
[fix] DocumentRegistry: only add provider once (#5947)
Fixes <https://github.com/koreader/koreader/issues/5946>.
2020-03-13 21:29:13 +01:00
poire-z
fa6fed8569 cre: setFontFace(): increase bias given to the main font
Solve the issue when a font without bold and italic variants
is used as the default font (e.g. FreeSerif), and the style
tweak "Ignore publisher font-family" is used (which uses
a trick to cancel any font-family by requesting a font
named "NoSuchFont"):
When text is italic or bold, any of the registered fonts
which have a real italic or bold variant would win over our
default font, as the best substitute to NoSuchFont-Italic.
This gives our default font a bit more bias so it can
win in its scoring against the other fonts, and be rendered
as fake italic or fake bold - which will ensure consistent
font and line height.
(A bit hacky, but no alternative solution found.)
2020-02-27 21:22:28 +01:00
Martín Fernández
5d103a41f8
Avoid writting highlights into read-only PDFs (#5889) 2020-02-25 21:26:19 +01:00
poire-z
5a4f5b4d59 bump crengine, migrate books to normalized xpointers
Enable new rendering feature COMPLETE_INCOMPLETE_TABLES
on all enhanced rendering mode, but have it disabled for
earlier cre_dom_version.
Also increase default_cre_storage_size_factor from 20 to 40.
2020-02-24 23:36:13 +01:00
NiLuJe
5499d85cbc
Allow running shell scripts from the FileManager/Favorites (#5804)
* Allow running Shell/Python scripts from the FM

* Show an InfoMessage before/after running the script

Since we're blocking the UI ;).

* Allow running scripts from the favorites menu, too.
2020-02-03 20:08:18 +01:00
poire-z
1b55baf437 cre: default to enable crengine call cache
Also reset cache when calling :enableInternalHistory(), as it solves
screen orientation change unit tests failures (although there is no
issue in regular use of the app).
2020-01-31 15:33:13 +01:00
poire-z
6f04ff546c cre: add toggable crengine call cache
Optimise usage of some of CreDocument methods by caching
their results, either globally, or per page/pos for those
whose result may depend on current page number or y-pos.
This helps a lot on cre books with a lot of highlights.
2020-01-17 17:42:07 +01:00
poire-z
2e947e6ffe PicDocuments: fix crash on hold + pan (#5742) 2020-01-04 10:35:17 +01:00
poire-z
5541d5f5d3 bump crengine: word spacing and hyphenation tweaks
Includes:
- New option to tune word spacing: space width scale percent
- Text: look for hyphenation in more words if needed
- CSS: fix "hyphens:none" should override inherited "hyphens:auto"
- getHtml(): grab dir= and lang= attributes from upper nodes

Replace our Word Gap/Space condensing toggle/setting with
a new Word Spacing toggle/setting, made of 2 values:
- 1st number scales the normal width of spaces in all font
  (100% uses the font space width untouched)
- 2nd number applies after the 1st has been applied, and
  tells how much these spaces can additionally be condensed
  to make more text fit on a line.
2019-11-29 23:45:12 +01:00
poire-z
558bd1ebeb cre fonts list: ignore nerdfonts/symbol.ttf
It's rejected anyway by crengine, this just avoids
an error from being logged.
2019-11-16 23:39:01 +01:00
poire-z
0fb780ea21 PicDocument: log reason of opening failure 2019-11-16 18:41:14 +01:00
yparitcher
6c68df42ec [feat] Open unsupported documents as text (#5497) 2019-10-23 23:15:30 +02:00
poire-z
7caa21a3fb [chore] Remove uneeded doc_settings:close() (#5504)
When just reading settings, no need to close and
write the file to disk.
2019-10-18 17:23:15 +02:00
poire-z
7de022a617
bump crengine: adds DOCX and FB3 support (#5498)
Includes:
- (Upstream) Unified cache for chars and glyph's indexes
- (Upstream) Glyph caching: optional use of hash table instead of a linked list
- (Upstream) Adds docx and fb3 support
- Update hardcoded elements list and stylesheets
- DocX: build a HTML DOM instead of a FB2 DOM
- Text: allow wrap after '/' and '-'
- Text: with Harfbuzz, split measurement on text node change
- Clear fonts on load and re-rendering
2019-10-17 15:17:35 +02:00
poire-z
5bc6bf046c
bump crengine, show progress meter on load/re-rendering (#5406)
Includes:
- Adds tinyNodeCollection::getStatistics()
- epubfmt.cpp: cleanup indentation and small optimisation
- Add more progress callback events
- Optimisation: avoid re-init for EPUBs with embedded fonts
- Fix: don't draw border when border-color: transparent
- CSS: ignore 'inherit' inside font-family

Show a small progress meter at top left of screen when
crengine is loading, re-rendering, and saving cache file
(after a 2 second delay to not be bothered on small books).

Also add a wrapper for the last remaining bit of code that
was accessing _document directly (:getPageOffsetX()).
2019-09-21 18:59:05 +02:00
poire-z
788e6d90df
Fix: don't create sidecar file when indexing pdf documents (#5384) 2019-09-16 08:22:26 +02:00
Frans de Jonge
59355200dc
[fix] PdfDocument: Hash collision (#5337)
A typo introduced in <https://github.com/koreader/koreader/pull/5282>.

This might resolve <https://github.com/koreader/koreader/issues/5323>, <https://github.com/koreader/koreader/issues/5327>.
2019-09-07 17:15:12 +02:00
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>.
2019-09-01 22:17:15 +02:00
Frans de Jonge
bc2412a67a
[doc] Convert koptinterface comments to LDoc format (#5290) 2019-08-31 21:15:22 +02:00