Commit Graph

259 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
NiLuJe b24ecf35d4 CreOptions: Display weight classes names, in addition to their raw value. 3 years ago
NiLuJe 56d7a2d86b CreOptions: Minor wording tweak after #7616
c.f., https://github.com/koreader/koreader/pull/7616#discussion_r622732969
3 years ago
poire-z 9ef435c97a
bump crengine: more granular font weights (#7616)
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.
3 years ago
hius07 3df1ce3644
Style tweaks: add links italic style (#7567) 3 years ago
NiLuJe ea3fa5c2c7
Calibre: More QoL tweaks (#7545)
* Wireless: Optimize memory usage in StreamMessageQueue (use an array of string ropes, that we only concatenate once). Allowed to relax the throttling, making transfers that much faster.
* Persist: Add a "zstd" codec, that uses the "luajit" codec, but compressed via zstd. Since both of those are very fast, it pretty much trounces everything in terms of speed and size ;).
* Persist: Implemented a "writes_to_file" framework, much like the existing "reads_from_file" one. And use it in the zstd codec to avoid useless temporary string interning.
* Metadata: Switch to the zstd codec.
3 years ago
NiLuJe 47c59e0e5a
Persist: Add the new native LuaJIT serializer to the list of supported codecs (#7543)
And swap the Calibre metadata cache to it.
3 years ago
NiLuJe 22b9396696
Centralize one time migration code after updates (#7531)
There have been a couple of these this month, and keeping stuff that should only ever run once piling up in their respective module was getting ugly, especially when it's usually simple stuff (settings, files).

So, move everything to a dedicated module, run by reader.lua on startup, and that will actually only do things once, when necessary.
3 years ago
poire-z 25aabd69d9 Style tweaks: remove "Toggle alternative EPUB content"
With MathML support, this is no longer all or nothing.
As it's quite rare and technical, let this be handled
via user style tweaks.
3 years ago
Frans de Jonge 975e2d4b80
Add DBNL footnotes styletweak (#7467)
`.voetnoten` is standard in DBNL ebooks.

A good test book can be found at <https://www.dbnl.org/tekst/veld028jnot01_01/>.
3 years ago
NiLuJe f0f69e9a7a
ReaderZooming: Fix defaults handling (#7463)
It appears the fancy split settings from #6885 were not being honored at all.

Also:

* Made sure "pagewidth" is actually the default zoom mode again, "full" had sneaked in as the default state of the zoom type toggle).
* Display human-readable values in the "Make as default" popup, instead of the raw, meaningless numerical setting.
* Disable zoom options when reflow is enabled, and restore 'em properly when it's disabled.

Fix #7461, #7228, #7192
3 years ago
Frans de Jonge 7a925a3caf
Improve fit to … help text (#7462)
Cf. https://github.com/koreader/koreader/issues/7461#issuecomment-809582341
3 years ago
NiLuJe e33476996a
Rotation icons: make 'em dynamic. (#7440)
Followup to #7306.

As discussed there, the only way to make everybody happy is to make 'em context-aware. At which point, trying to make the fact that it's a *device* rotation and not a *content* one come across in the icon design loses its interest, and would actually only further muddy the issue.

So, these are similar is spirit to the traditional rotation icons in pretty much anything that can rotate text content, with a special inspiration from the Kindle 4 & PocketBook UI.

Fix #7429
3 years ago
NiLuJe bf6c0cdd6c
LuaSettings: Add a method to initialize a setting properly (#7371)
* 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).
3 years ago
NiLuJe 32b070f3ac
Dispatcher: nil guard against access to a document instance (#7389)
Also:
* Properly update *all* the touch zones when rotating the FM
* Unbreak (Reader) rotation labels in Dispatcher
Regression since #7306
3 years ago
josdion 3d8d40d797
Add Bulgarian keyboard layout (#7367) 3 years ago
poire-z 0883202e07
bump crengine: CSS line-break/word-break, various fixes (#7342)
Includes:
- LVString: Fix a c/p issue in lString8::atoi64
- LVTextFm: Simplify and fix resizeImage logic
- LVXMLParser::ReadText(): fix parsing at buffer boundaries
- TextLang: fix lang_tag first part comparison
- CSS font-family: fix parsing of 'inherit' and '!important'
- CSS: support a few -epub-* and -webkit-* properties
- Text fragment flags: add LTEXT_HAS_EXTRA
- CSS: add support for 'line-break' and 'word-break'
3 years ago
NiLuJe 1820c616a1
[RFC] Switch ConfigDialog's rotation toggle to custom icons (#7306) 3 years ago
Frans de Jonge 893026a2ef
[chore] Fix a few Persian keyboard luacheck issues (#7253)
Cf. <https://github.com/koreader/koreader/pulls#issuecomment-774345230>.
3 years ago
poire-z 3b89e32069 [UX] Add ToC/Bookmarks settings
- Menu widget: allow specifying the number of items per
  page and the item font size, so we can use other values
  than the default File browser ones
- Menu: fix setDirty when a border is used
- ToC: add item per page and font size settings, make
  Alternative ToC more visible (was previously
  available on long-press on Table of contents)
- Bookmarks: add item per page, font size, size reduction
- Progress bars (Skim widget and footer): allow selecting
  ToC depths from which ticks are made.
3 years ago
Monirzadeh 6f50d67b5d
[UX] Add Persian keyboard (#7222)
Fixes #5791.
3 years ago
NiLuJe b41567e0e6 ConfigDialog: Check alt_name_text if name_text isn't set,
as it is used for the "Set as default" popup.
This allows having that text accurate on widgets without an
actual name_text (e.g., the font size wheel).

Fix #7231

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
3 years ago
poire-z cdafd9438c Georgian keyboard: remove unused variable (luacheck) 3 years ago
Beka Arabuli f665a25e70
Georgian keyboard (#7225) 3 years ago
poire-z 49e2d91afb Don't toggle the footer when toggling the top status bar 3 years ago
poire-z 05126b94b6 Dual pages: shown as 2 columns on a single page
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)
3 years ago
Frans de Jonge 5c9dc850e8
Address assorted Weblate comments (#7154)
* Fix typo in dropbox

Reported by @lescheck

* Rephrase text justification explanation more elegantly

* CoverBrowser: fix up some plurals

* Statistics: remove random use of template function

* Use ngettext for minute/minutes and second/seconds

* Change KB/MB/GB to kB/MB/GB SI units
3 years ago
poire-z 396d1fbf46
bump crengine: parsing, lists, 2-pages mode fixes & tweaks (#7138)
Includes:
- EPUB: fix truncated HEAD>STYLE stylesheet
- XML parsing: slightly better parsing of <script>
- Update German hyphenation patterns
- (chore) Silence some clang warnings
- (Upstream) CSS content: fix regression with open-quote/close-quote
- (Upstream) HTML lists: support the 'reversed' attribute
- (Upstream) Tweak list items disc/circle/square symbols
- 2-pages mode: option to skip geometry checks

CRE bottom menu: allow toggling Dual Pages in portrait mode.
3 years ago
poire-z 9b11497652 KOPT bottom menu: hide it when applying Zoom options 3 years ago
poire-z b92c078e9c ConfigDialog: temporarily hide when showing SpinWidgets
Hide bottom panel when showing a SpinWidget, so we gain
on the bottom the space covered by the SpinWidget to see
more how a change is affecting the book text.
For clarity, rename delay_repaint & refresh_callback
to hide_on_apply & when_applied_callback.

Normalize SpinWidgets: have them both accept a
cancel_callback and a close_callback.
InfoMessage: call dissmiss_callback also on timeout.
3 years ago
poire-z 4043ba27b0 CRE: fix to Top/Bottom margins fine tuning
Rework eb66856d so that "Sync T/B Margins" is disabled
when set Top and Bottom margins differ (previously,
the bottom one was taking over the top one when
it was enabled).
3 years ago
NiLuJe 3060dc81af
Revamp "flash_ui" handling (#7118)
* Wherever possible, do an actual dumb invert on the Screen BB instead of repainting the widget, *then* inverting it (which is what the "invert" flag does).
* Instead of playing with nextTick/tickAfterNext delays, explicitly fence stuff with forceRePaint
* And, in the few cases where said Mk. 7 quirk kicks in, make the fences more marked by using a well-placed WAIT_FOR_UPDATE_COMPLETE

* Fix an issue in Button where show/hide & enable/disable where actually all toggles, which meant that duplicate calls or timing issues would do the wrong thing. (This broke dimming some icons, and mistakenly dropped the background from FM chevrons, for example).
* Speaking of, fix Button's hide/show to actually restore the background properly (there was a stupid typo in the variable name)
* Still in Button, fix the insanity of the double repaint on rounded buttons. Turns out it made sense, after all (and was related to said missing background, and bad interaction with invert & text with no background).
* KeyValuePage suffered from a similar issue with broken highlights (all black) because of missing backgrounds.
* In ConfigDialog, only instanciate IconButtons once (because every tab switch causes a full instantiation; and the initial display implies a full instanciation and an initial tab switch). Otherwise, both instances linger, and catch taps, and as such, double highlights.
* ConfigDialog: Restore the "don't repaint ReaderUI" when switching between similarly sized tabs (re #6131). I never could reproduce that on eInk, and I can't now on the emulator, so I'm assuming @poire-z fixed it during the swap to SVG icons.
* KeyValuePage: Only instanciate Buttons once (again, this is a widget that goes through a full init every page). Again, caused highlight/dimming issues because buttons were stacked.
* Menu: Ditto.
* TouchMenu: Now home of the gnarliest unhilight heuristics, because of the sheer amount of different things that can happen (and/or thanks to stuff not flagged covers_fullscreen properly ;p).

* Bump base
https://github.com/koreader/koreader-base/pull/1280
https://github.com/koreader/koreader-base/pull/1282
https://github.com/koreader/koreader-base/pull/1283
https://github.com/koreader/koreader-base/pull/1284

* Bump android-luajit-launcher
https://github.com/koreader/android-luajit-launcher/pull/284
https://github.com/koreader/android-luajit-launcher/pull/285
https://github.com/koreader/android-luajit-launcher/pull/286
https://github.com/koreader/android-luajit-launcher/pull/287
3 years ago
poire-z eb66856d81
CRE: allow both Top/Bottom margins fine tuning (#7104)
By having the same DoubleSpinWidget launched when
hitting "..." on any of Top margin or Bottom margin
progress bars.
DoubleSpinWidget: remove blank space when no info_text.
3 years ago
yparitcher c3fd6ae38b Margins: allow direct input (more_options) 3 years ago
poire-z 24424e505e Update UI layout code to use new SVG icons
- Add IconWidget, use it for icons instead of ImageWidget.
  Specify icons by name only, look for them (with either
  .svg or .png suffixes) in multiple directories (including
  koreader/settings/icons/ to allow customizing them).
  Don't crash when icon name not found, shown a black
  background warning icon instead.
- Don't trust the icons' native sizes: replace
  scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
  so all icons get the same (tunable) size - except in
  a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
  properly centered in them, extend vertical line
  separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
3 years ago
poire-z a0eb91d6ab
Some RTL UI fix up after #6885 (#6975)
Avoid crash with RTL UI after options we moved.
Swap Zoom direction items when RTL UI.
Also don't check show_func when sizing the names
on the bottom menu, to avoid icons moving or
resizing when toggling options.
3 years ago
Frans de Jonge 908e3ae363
[chore] Don't translate numbers (#6928)
Cross-ref to <https://github.com/koreader/koreader/pull/6885>.
3 years ago
jperon 1f16815f94
[chore] Get rid of ui/data/strings.lua (#6921)
As suggested [here](https://github.com/koreader/koreader/pull/6885#issuecomment-734865881)
3 years ago
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
3 years ago
tastytea 9277568a65
Apply CSS tweaks for links to all elements below a elements. (#6856)
This is for ebooks that have <span> inside of <a>.
4 years ago
poire-z 8f2bdf959d Style tweaks: fix some wording 4 years ago
Marek Gibek 20a413389c
[UX] Add Polish keyboard layout (#6762) 4 years ago
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
4 years ago
poire-z c8b8ee3ba9
bump crengine: better linebreaks at em-dash, fb2 fixes (#6521)
Includes:
- (Upstream) LVBase64NodeStream: fix possible segfault
- (Upstream) Fix getting encoding from HTML META tags
- FB2: also look for cover in <src-title-info>
- FB2: fix cover image colors
- FB2: don't draw cover in scroll mode
- TextLang: better linebreaks at em-dash (EN/ES/FR)
- TextLang: increase _lb_props static array size

FB2 footnotes style tweaks: avoid gap above first footnote,
caused by the title bottom margin collapsing into it.
4 years ago
poire-z cc653ef5b0 Style tweaks: limit EPUB/FB2 footnotes to these formats
Avoid conflicts having "In-page EPUB footnotes (smaller)"
affects FB2 documents that use "<a type=note>12</a>" which
would then get smaller if both tweaks are enabled (which
they are, by default).
Also switch "-cr-hint: strut-confined" from being set on "*"
to being set only on "body", now that it is inherited.
Footnote popups: add styles for some non-HTML FB2 tags,
so MuPDF can render them as expected.
4 years ago
zwim 4349272d9c
[UX] German keyboard layout qwertz (#6385)
Add support for German keyboard. It's mainly en_keyoard.lua with changed z/Z and y/Y.
4 years ago
yparitcher f7d538b108
Landscape FM / Refactor rotation (#6309)
* landscape FM / Refactor rotation

refactor and simplify the orientation handling code. the user generally cares about the rotation (what direction the device is facing) and not about if koreader is displaying in portrait or landscape mode

* bump base

update luasocket, libjpeg-turbo, curl
add logging to evernote-sdk-lua
update framebuffer for proper rotation
4 years ago
poire-z 71744688c7 Style tweaks: use 0.8rem instead of 80% for in-page footnotes 4 years ago
poire-z 8a568a2721 bump crengine: add support for <ruby> elements
Includes:
- Fix some non-recursive subtree walkers
- Text: skip formatting optimisations when inlineBoxes
- CSS parsing: parse selectors starting with [attrib]
- Use T="" for internal elements attributes
- CSS: re-order css_d_* (display) enum for easier checking
- Rendering methods: remove erm_table_cell
- Rendering methods: remove erm_table_caption
- Rendering methods: remove erm_list_item
- getRenderedWidths(): better estimate table width
- styleToTextFmtFlags(): adds is_block parameter
- Adds support for "display: ruby" and <ruby> elements
- Fix prev/next-VisibleWord-Start/End() with CJK text

Also bump HarfBuzz to 2.6.8 and evernote-lua-sdk.
4 years ago
smartscripts-nl 23ab5750c3
Fix missing glyphs Ï and Ö in keyboard popup (#6254)
Fixes #6221.
4 years ago