Also adds options to remove statistics for books
with low reading duration (to clean up stats for
books just quickly browsed and not yet read).
Also adds TextWidget:getFontSizeToFitHeight()
even if we ended up not using it.
Try to limit the nb of items per menu page to 5 or 6 by
splitting related ones into sub-menus, so we get more
room below to see how they affect the content.
Adds "No indentation on first/following paragraphs" and
"Paragraphs margins and paddings", and Links underlining.
The default left margin on blockquote and dd is `40px`, but unfortunately that doesn't scale. rem is calculated using a hardcoded16px, so em or % is the best compromise in this case.
PS If we assume 1em = 16px then 40px is actually 2.5em, not 1em. This reduction in indentation is mainly intended for the benefit of smaller E Ink devices.
Closes <https://github.com/koreader/koreader/issues/5859>.
* Unbreak OTA on crappy shells
Very, very old ash versions abort on set -o failures (as mandated by
POSIX, granted). This makes it impossible to reliably catch failures in
a single step.
So do it from the Lua side instead.
Should fix#5844
* Launch the zsync wrapper through bash on Cervantes
Previous cleanup resurrected multiple class names, so
we know now the original alignment of a float.
Use them in 'web' mode, as it allows floats to be nearer
the section they are refering to, and it may limit
floats truncation in page splitting.
But keep floats aligned on a single side in 'book' mode,
as it might allow easier reading.
* Also remove the temporary files when doing a full retry
* Bump base
Pickup the required zsync2/FBInk updates
(https://github.com/koreader/koreader-base/pull/1038)
* Actually does what it says on the tin for Abort
i.e., cleanup temporary files
* remarkable: remove unnecessary screen invalidate on resume
This is handled in uimanager if needsScreenRefreshAfterResume is enabled
(which is the default).
* remarkable: pass a path argument to reader.lua
Otherwise if lastfile is not set in the settings (e.g. install and then
exit without opening a file) koreader will just refuse to start.
* remarkable: pass koreader.sh args (if any) through to reader.lua
Touchscreen is mirrored in X & Y and has a different resolution from the eink panel.
Uses systemd for time/date/suspend/poweroff/reboot
Two systemd units for platform integration. button-listen is a very
simple launcher.
to-do: add support for wifi by implementing a wpa supplicant dbus client.
Authored-by: Thomas Spurden <tcrs@users.noreply.github.com>
OPDS catalogs may have search query capabilities. It is very usefull to find a
book in huge catalog, even when they are organized as directories. This commit
provides the possibility to add a %s mark in an OPS catalog URL, that would
trigger a search box when browsing the OPDS in koreader.
* File search: Don't traverse hidden folders if we're not showing them
Re https://www.mobileread.com/forums/showpost.php?p=3949194&postcount=21
* Ignore macOS resource forks, too.
* Apply the same logic to the BookInfo directory walker
* And never ever show resource forks in the FM, either.
It's extremely confusing, as it has nothing to do with calibre catalogs,
which are actual things the user can generate manually.
What it's using instead is actually a metadata cache in a flatfile db
that's always present, as long as "Send To Device" was used to upload
the content to the device.
* 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.
Strings are prefilled by msgmerge with closely matching ones to reduce the amount of labor required by the translator. Often the string requires only minor adjustment, making the process faster, and when the string isn't a good match it's no big deal. However, these so-called fuzzy strings shouldn't be treated as if they were actually translated.
Fixes the effect seen in <https://github.com/koreader/koreader/issues/5806>.
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).
* Don't store stale screen/rotation modes in book's settings!
Gyro events *may* entirely bypass the local copy...
In any case, using a local copy was essentially asking for trouble...
Actually fix#5772
(because the issue was indeed that a Gyro swap from Portrait to Inverted
Portrait wasn't stored properly).
* Allow showing ScreenSavers in Inverted Portrait.
That works just fine, and won't lead to the confusing situation where a
lefty might pick up the device as a righty because the ScreenSaver
happens to be shown that way, only to have it rotate back to its lefty
orientation on wakeup...
MuPDF does not handle "text-align: justify" correctly on
RTL text: the last line is left-aligned, but it should be
right-aligned.
Not using justify makes it correctly right align the whole
text.
Gives the book language to Text*Widget (and XText) when
drawing title, authors and other metadata text.
Might be needed to properly display a Japanese book title
when the UI language is Chinese.
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.
Includes:
- lvtinydom.cpp: fix Use-after-free
- lvtextfm: fix/cleanup lastnonspace code bits
- lvtextfm: fix vertical-align: top & bottom
- renderBlockElementEnhanced: minor fixes related to floats
- renderBlockElementEnhanced: compute baseline of block
- Add support for display: inline-block/inline-table
- Better selection highlighting by using getSegmentRects()
- getHtml(): add flag to get text soft-hyphenated
cre.cpp: toggable text selection highlighting method,
default to the new one using segments.
Update various cre flags to use the new features (and
to conform with some flags re-ordering):
- support display: inline-block in flat, book and web
render modes.
- get HTML with soft-hyphens for footnote popups, so MuPDF
can use them when rendering the footnote.
bidi.lua:
- Revert "Alias everything to Bidi.nowrap() when in LTR UI,
as using LTR isolates seems uneeded when already LTR" (part
of a628714f) which was a wrong assumption: we need proper
wrappers for all things paths. Enhance some of these wrappers.
- Fix GetText RTL wrapping which was losing empty lines and
trailing \n.
- Wrap all paths, directories, filenames in the code with
these wrappers.
- Wrap all book metadata (title, authors...) with BD.auto(),
as it helps fixing some edge cases (like open/close quotation
marks which are not considered as bracket types by FriBiDi).
(Needed some minor logic changes in CoverBrowser.)
- Tweak hyphenation menu text
- Update forgotten SortWidget for UI mirroring
- KoptConfig: update "justification" index for RTL re-ordering,
following the recent addition of the page_gap_height option.
Ellipsis was sometimes not displayed when text is right aligned,
because width was not updated with ellipsis size.
bump base/xtext: fix truncation ellipsis position in bidi text
so it stays nearer to previous logical order char, instead of
sometimes being thrown away to start or end of line.
Replaces DAUTO_SAVE_PAGING_COUNT in defaults.lua with
a new option available in menu, that allows setting
an interval in minutes instead of a page count.
The Japanese keyboard still needs to be cleaned out a bit more at some point, but the important thing is that this commit fixes#5632 by restoring the kanji layer with the voiced-unvoiced conversion symbol.
- Alias everything to Bidi.nowrap() when in LTR UI, as using
LTR isolates seems uneeded when already LTR.
- Better wrapping of RTL filename by using auto direction and
LTR-isolating only the suffix so it's always on a side.
- menu.lua: handle bidi_wrap_func outside getMenuText(), which
may be used in other contexts.
- Add BD.filepath() and BD.dirpath()
- bump crengine: (Upstream) DocX: fix paragraphs with single hyperlink
- bump fribidi to 1.0.8 (for nested isolates fix)
- xtext.makeLine(): return no_allowed_break_met=true when that
happens, so we know the line breaks inside a word.
TextBoxWidget: add forgotten property (when use_xtext=true) when no
line break opportunity was found: has_split_inside_word=true.
(Only used by CoverBrowser Mosaic mode to make nicer text covers
by reducing font size when that happens.)
Bump base for util.fsyncOpenedFile() and util.fsyncDirectory().
Use these to force flush to storage device when
saving luasetting, docsetting, and history.lua.
Also dont rotate them to .old until they are at least
60 seconds old.
Also make auto_save_paging_count count right.
Also bump crengine: open (as text) small or empty files
A few fixes and enhancement related to bold text:
- When using bold=true with a regular font, use its bold
variant if one exists (can be prevented by manually
adding a setting: "use_bold_font_for_bold" = false).
- When using a bold font without bold=true, promote bold
to true, so fallback fonts are drawn bold too.
- Whether using a bold font, or using bold=true, ensure
fallback fonts are drawn bold, with their available bold
variant if one exists, or with synthetized bold.
- When using a bold variant of a fallback font, keep using
the regular variant as another fallback (as bold fonts
may contain less glyphs than their regular counterpart).
- Allow providing bold=Font.FORCE_SYNTHETIZED_BOLD to
get synth bold even when a bold font exists (might be
interesting to get text in bold the same width as the
same text non-bold).
- Use the font realname in the key when caching glyphs,
instead of our aliases (cfont, infont...) to avoid
duplication and wasting memory.
Small tweaks all around to handle UI mirroring:
- swap existing symbols like arrows, or use alternative ones
- rotate some images, like chevrons and dogear icons
- flip some left and right swipe handling
- flip some geometry arithmetic like tap on left or right
side of page or dict window
- use new ProgressWidget:getPercentageFromPosition() instead
of geometry arithmetic
- BD.wrap() some concatenated string bits, like in reader
and menu footers
- flip inverse_reading_order when UI is mirrored
More specific tweaks:
- ReaderGesture: reset some specific gestures when UI direction
has changed (tap on top/bottom left/right corners, for
bookmarks and FileManager "Plus menu").
- ReaderRolling: show markers on the correct side of page,
in single or dual page mode.
- KoptOptions: swap left and right icons in Alignment toggle
- CheckMark: proper rendering in all 4 mirroring/rtl combinations.
- VirtualKeyboard: forbid any mirroring
- Move util.getMenuText into Menu.lua
Allow TextBoxWidget new text direction/lang parameters to be
set on upper widgets, and propagate them all the way to it
(ScrollTextWidget, InputText, InputDialog, TextViewer).
Use specific non-default ones in some specific cases:
- Force LTR text direction when showing HTML and CSS, and
configuration files (in some plugins).
- Use Wikipedia server language and text direction when
showing an article.
- Use auto with Dictionary results, as we don't know the
dictionary language, and they may contain mixed content.
- Force LTR when showing some paths (still needs more of them)
TextEditor plugin: add 2 new options "Auto paragraph direction"
and "Force paragraph direction LTR".
Footnotes popup: grab HTML direction, and forward it
to MuPDF for proper display.
Set default language (for Harfbuzz to pick up localized glyphs
in a font), default text direction, and UI element mirroring
depending on the UI language.
Use some HorizontalSpan for padding between key and value,
instead of prepending a space to the value text (which
won't work as expected if value text is RTL, as it would
be put on the right side of screen).
Changes in this commit:
- Fix arrays to large (10 elements instead of 8) copied from the old keyboard system. Issue introduced in #5610
- Add ё popup.
- Change shift key as per #5659 (for both ro and ru keyboards)
- Translate Russian space and symbol keys.
- Rename Sym key to 123
Happens with "Inverse reading order", which re-registers
the Reader tap forward/backward zones and would prevent
tap menu and bookmark from working.
Before, when removing them, we would lose all the override=
set on them by other touch zones (tap menu, bookmarks...),
and so they were no more ensured after re-adding the zone.
So, make sure we don't lose that info.
This adds a new separate Romanian keyboard layout, with popup support.
- Functional buttons are translated.
- Pages 5&6 contain 3 groups of characters (I tried my best to group them logically):
- On the left: traditional Romanian cyrillic pre-1850s
- On the middle latinised forms from 1850s onwards
- On the right modern diacritics from 1900s to today
- Pages 7&8 add only large double quotes and section/paragraph mark.
- Popups are only avalable for most common diacritics. Swipe up for circumflex, swipe down for breve.
I can really call this the most complete though-the-ages Romanian keyboard. :)
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.
The japanese keyboard being taller than the others, when
switching to/from it from/to another layout:
- re-init InputDialog for proper sizing and positionning
- refresh the whole screen, to remove any trace of
a previous taller keyboard
Also add calls to :free() here and there to free keyboard
keys' TextWidgets' XText C objects without waiting for GC.
The korean keyboard wraps InputText and overrides some
of its methods to process input in some specific way.
When switching to another keyboard layout, the original
methods need to be restored.
* Switch the last few remaining icons to true glyphs
(Del/Backspace & Enter).
Also, allow a glyph to be rendered in (fake) bold, and use it for Enter.
* Update fonts
Pickup the tweaked nerdfonts for the backspace symbol
closes#5612
the change in `ReaderView:recalculate()` causes the viewable page size to be calculated by not including the footer, causing the text not to get cut off.
since the page area was not drawing under the footer `ReaderView:drawPageSurround()` had to be fixed to draw the margin under the footer so when tapping the footer off the area should be dran the background color.
Follow-up to #5583.
* Add separate Cyrillic/Russian keyboard
* And remove that from English
* Update French keyboard (is easy)
* Remove yahzhert, that was just a double of QWERTY
* Update Spanish keyboard
* Reduce Japanese to 4 layers and add globe
* Reduce Korean to 4 layers
* Reduce Greek to 8 layers
Option to synchronize files in local koreader folder with folder on Dropbox. All files that aren't on the local disk will be downloaded. Files with different sizes will also be downloaded and overwritten.
The download process can be paused or stopped at any time (similar to downloading images in Wikipedia).
Synchronize and settings are available after long press in dropbox account in Cloud storage.
Limitations: Only one folder (without subfolders) can be synchronize with one folder on local storage.
- height_adjust: if true, reduce height to a multiple of
line_height (for nicer centering)
- height_overflow_show_ellipsis: if height overflow, append
ellipsis to last shown line
(Implemented in both use_xtext and legacy code path.)
Use them in Menu.lua to clean up/shorten the code used for multiline
menu items by delegating the work to TextBoxWidget, or using
TextWidget when we end up needing only a single line.
Alternative code to size, split lines and draw text with
the help of the xtext Lua C module.
Enabled by default (can be disabled via an added menu
item in "Developer options").
New properties can be specified by calling widgets, only
used when xtext is used:
- lang: use specified language instead of the UI language
- para_direction_rtl: true/false to override the default
direction for the UI language
- auto_para_direction: detect direction of each paragraph
in text
- alignment_strict: prevent the inversion of the specified
alignment= that is done when a paragraph direction is
set or detected as RTL.
Also: fix possible memory leak (present even when not using xtext)
by calling :free() in onCloseWidget() like it's done in ImageWidget.
Alternative code to size and draw text with the help
of the xtext Lua C module.
Enabled by default (can be disabled via an added menu
item in "Developer options").
New properties can be specified by calling widgets, only
used when xtext is used:
- lang: use specified language instead of the UI language
- para_direction_rtl: true/false to override the default
direction for the UI language
- auto_para_direction: detect direction of each paragraph
in text
bump base for libkoreader-xtext.so:
- ffi/pic.lua: fix memory leak with some unsupported PNG files
- FreeType ffi: add methods for use with Harfbuzz shaping
- thirdparty: adds libunibreak
- Adds libkoreader-xtext.so: enhanced text shaping
Add a getFallbackFont(N) to each Lua font object to instantiate
(if not yet done) and return the Nth fallback font for the font.
Fallback fonts list: add NotoSansArabicUI-Regular.ttf
Add RenderText:getGlyphByIndex() to get a glyph bitmap by glyph
index, which is what we'll get from Harfbuzz shaping.
(RenderText:getGlyph() works with unicode charcode).
Tapping to turn page while some image is loading was
interrupting the image loading, but not turning the page,
since a82d7832 where using trap_widget=false is to be
used to not resend the event (while =nil does resend it).
It might be slower, but is needed to properly display
books in arabic, indic...
Also bump crengine: use FreeType "light" hinting algorithm,
which hints on the y-axis only (and so avoid messing with
advances and kerning on the x-axis).
* Restore '+' prefix when charging in the footer w/ letters prefixes
Regression since #5537
* Don't use a full battery icon in the menu entry
Make it clear that one isn't in-sync with the current gauge
* Unify battery meters look'n feel
Switch to proper (vertical) battery icons (one per 10% steps).
Fix#5535
* Bump fonts (https://github.com/koreader/koreader-fonts/pull/7)
Because we need the new symbols from nerdfonts ;).
(used by bookmarks list and classic file browser)
When text is too long or line too tall:
first: we try to decrease the number of lines (eg from 3 to 2 and from 2 to 1 line)
second: when 1 line is too tall, we try to decrease font size (-1)
And at the end we try to add or remove chars to better fit text.
Lots of code was doing some renderText calls to get the size
of some text string, and truncate it to some width if needed,
with or without an added ellipsis, before instantiating
a TextWidget with that tweaked text string.
This PR fixes/adds some properties and methods to TextWidget
so all that can be done by it. It makes the calling code
simpler, as they don't need to use RenderText directly.
(Additionally, when we go at using Harfbuzz for text rendering,
we'll just have to update or replace textwidget.lua without
the need to update any higher level code.)
Also:
- RenderText: removed the space added by truncateTextByWidth
after the ellipsis, as it doesn't feel needed, and break
right alignment of the ellipsis with other texts.
- KeyValuePage: fix some subtle size and alignment issues.
- NumberPickerWidget: fix font size (provided font size was
not used)
* Changed File Browser text
KOReader looks nicer than KOReader File Browser,
* Remove the "page x of x" if only one page
Removes it from the bottom of the file browser
* Remove the "page x of x" if only one page
Removes it from the top menu, if there is only one page, why show page 1 of 1
* Renamed ~ to Home
Since the file browser can be considered "Home"
* Added 12 hour time option
Also tweaked the charging icon, ⚡ looks nicer than +, tweaked seperator between time and battery, - instead of @
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
With some particular document switching workflows, the
screensaver menu could lose its last item, and shrink
to having zero item, and eventually cause a crash.
* Don't break `doc_pages` updates when it's completely disabled. (c.f., the commit's comment, doing it on every page turn seems a bit overkill, but I get that it's probably done that way because it was easier ;)).
* Detect the empty footerTextGenerator properly in `_updateFooterText` (it's `""`, not `nil`).
* Abort `_updateFooterText` early when the footer is invisible (and has been for a while/ever, i.e., when not requesting a repaint, like a mode switch would).
* Never send `SetBottomPageMargin` events twice.
* Minor tweaks to touchmenu & configdialog to avoid useless repaints (don't redraw the reader/fm unless we absolutely need to).
* Make sure we show the progress bar alone instead of nothing when disabling the last enabled mode in the menu.
Tap any part of screen to toggle bottom buttons visibility.
Swipe south to quickly close it (as long as image is scaled
to fit, and there's no need for panning).
bump crengine: enhanced RTL block rendering.
Includes:
- Re-enable: Use the same FT load flags in HB as in FT
- Avoid redundant calls to getStyle()
- CSS: parse and store "direction:"
- Enhanced block rendering: handle RTL direction
- Enhanced block rendering: handle RTL tables
- Pagesplitting: account for lines' text direction
- CSS: add support for more pseudo-classes
- epub.css: a few updates for RTL documents
- Fix LVDocView::getBookmark() which could be slow or wrong
Add a few style tweaks useful to RTL readers.
Wikipedia Save as EPUB: build proper RTL documents from
persian, arabic, hebrew (and others) Wikipedia articles.
sysfs_light handles every case sanely already, no need to be cute ;).
This prevents always setting the warmth when setting the FL on NL
devices with a mixer, because, besides being useless, it's also slow
(lua does mmap'ed io, so every handle requires an fstat + mmap).
It was subtly affecting the fluidity of the toggle ramp, and much less
subtly wreaking havoc on #5373 ;).
KA1 owners might want to investigate keeping the fds around one way or
another, like we do for the fl ioctl, to alleviate the overhead of doing
that for not one but three or four fds...
I won't be doing that, since I lack the hardware to test it, and FL+NL
stuff is pain.
* Do the same on Cervantes
* Bump base to pickup related ioctl tweaks
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()).
When reasonably possible, the program should only crash in debug mode.
Adds a couple of extra unit tests to prevent regressions and adds docs.
Fixes <https://github.com/koreader/koreader/issues/5356>.
`self.inverse_reading_order == nil and G_reader_settings:has("inverse_reading_order")` could easily be false, which would then incorrectly turn the setting off.
Fixes <https://github.com/koreader/koreader/issues/5346>.
* Restart KOReader after a crash, after showing a fancy crash recap screen (our very own Gray Screen of Death!).
Kobo only, because it's possibly the platform where getting booted out
of KOReader is the most annoying.
Keeps track of crashes, to be able to give up after a while, in order to
avoid boot loops in the unlikely event of a crash loop on startup.
Adds a dev option to *always* exit KOReader after the crash screen.
And a couple bugfix this unearthed:
* Always set the default as the *current* value, no matter what (by chance, this was not an issue for margins).
* Don't crash on the hold gesture in the -/+ buttons for the horizontal margins (regression since #5303).