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).