It can happen in perfectly sane contexts.
CReDocument: Don't destroy internal engine data when Document just
decreased the refcount (as opposed to actually tore down the document
userdata if it were the last ref).
PdfDocument: Only write edited documents if the Doc instance was torn
down.
PicDocument: Silence some DocumentRegistry related warnings
Use a table & table.concat instead of individual concats.
And then use that same table for every hash-related operation.
(Nothing else uses the configurable hash function, otherwise I'd have
limited the table shenanigans to the function itself).
* Allow doing away with CacheItem
Now that we have working FFI finalizers on BBs, it's mostly useless overhead.
We only keep it for DocCache, because it's slightly larger, and memory pressure might put us in a do or die situation where waiting for the GC might mean an OOM kill.
* Expose's LRU slot-only mode
And use it for CatalogCache, which doesn't care about storage space
* Make GlyphCache slots only (storage space is insignificant here, it was
always going to be evicted by running out of slots).
* More informative warning when we chop the cache in half
* Neuter timekeeping when statistics are disabled
Saves a few syscalls ;).
* Port to ffi/lru
Only a tiny bit of it actually requires any sort of LRU logic, so it's fairly painless.
* Release the cache on close
* Use string.buffer to serialize function arguments
Ought to be faster than the custom approach ;).
(Still requires wrapping them in a table, though).
It's much less human-readable, but then again, this doesn't need to be :).
Ought to be faster than our naive array-based approach.
Especially for the glyph cache, which has a solid amount of elements,
and is mostly cache hits.
(There are few things worse for performance in Lua than
table.remove @ !tail and table.insert @ !tail, which this was full of :/).
DocCache: New module that's now an actual Cache instance instead of a
weird hack. Replaces "Cache" (the instance) as used across Document &
co.
Only Cache instance with on-disk persistence.
ImageCache: Update to new Cache.
GlyphCache: Update to new Cache.
Also, actually free glyph bbs on eviction.
* 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.
Includes:
- MathML: a few minor fixes
- (Upstream) lvtext: fix possible index out of range
- Fonts: RegisterExternalFont() should take a documentId
- Fonts: fix: letter-spacing should not be applied on diacritic
- (Upstream) Fonts: more granular synthetic weights
- Fonts: synthesized weights: tweak some comments
- Fonts: keep hinting with synthetic weight
- Fonts: fix synthesized weight inconsitencies
- Fonts: fix getFontFileNameAndFaceIndex()
- Fonts: adds LVFontMan::RegularizeRegisteredFontsWeights()
- Fonts: handle synth_weight tweaks in glyph/glyphinfo slots
- (Upstream) Fonts: fix some compiler warnings
- Fix hyphenation on Armenian and Georgian text
Update the bottom menu widget "Font Weight" to allow more
granular weights than the previous "regular | bold".
Also bump thirdparty/luasec to v1.0.1.
Includes (among others):
- LVImg: Tweak JPEG decoding some more
- toStringV2(): fix (again) when target node is a boxing node
- LVFontCache::find(): give more weight to first fonts in list
- Page splitting: more accurate rendering progress
- getRenderedWidths(): fix nowrap around image/inlineBoxes
- Tables rendering: tweak column widths algorithm
- CSS: parse/handle "currentcolor", default for border-color
- CSS: add units 'ch' (just like 'ex')
- SVG images: proper alpha blending
- MathML: add parsing and rendering support files
- MathML: plug MathML code into crengine core
- MathML: <epub:switch/case/default>: accept MathML
- (Upstream) Make crengine.font.fallback.faces plural
- (Upstream) Option to not limit font size to a set
- Text: dont adjust space after consecutive initial marks/dashes
- Update German hyphenation patterns
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default.
Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved.
(Fixes an issue reported on Gitter).
* LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings.
* Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses.
* FileChooser: Implement an extended default exclusion list (fix#2360)
* ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix#4418).
Rework Dual pages code so that the view is considered
a single page number, so it looks more like 2-columns
on a single page.
This solves a few issues like:
- Page number and count are consistent between top
and bottom status bars
- SkimTo -1/+1 doing nothing every other tap
- Statistics being wrong (like "Pages read" never
going over half of the book page count)
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).
* 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 ;).
- 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
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.
* 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
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).
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
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
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
* 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
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.)
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",
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.
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.
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.