Commit Graph

3594 Commits (04d9a557aabbb49cd70bcc7de1579d7e9b56c145)

Author SHA1 Message Date
poire-z 04d9a557aa Use fsync() for more robust setting files saving
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
4 years ago
poire-z 1e1ceedd4d [i18n] Add translator notes for footer letter prefixes 4 years ago
poire-z 55f3575a10
UI font rendering: use available bold fonts for bold (#5675)
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.
4 years ago
yparitcher b578d8aa8b Fix continuous scroll & footer overlap (#5657)
closes  #5654

like #5620 but for continuous mode.
4 years ago
poire-z 7952fa2c09 [RTL UI] update widgets and apps for UI mirroring
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
4 years ago
poire-z 36ce82d8c2 [RTL UI] update low-level widgets to handle mirroring
These updated low-level widgets will handle 90%
of the needed UI mirroring.
4 years ago
poire-z d6d49a64a7 [RTL UI] use auto or LTR text direction in some specific cases
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.
4 years ago
poire-z 866c9571df [RTL UI] adds bidi.lua, bootstrap UI mirroring with RTL languages
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.
4 years ago
poire-z 3c280f6e5f KeyValuePage: proper padding between key and value
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).
4 years ago
poire-z ef08f50336 DictQuickLookup: properly truncate title text 4 years ago
Martín Fernández a5069f1c26 android: make system fonts toggable (#5670)
Also add droid font back to android and remove the workaround
4 years ago
Martín Fernández 72e5574ca7 android: allow overrides on 3rd party dictionary list 4 years ago
poire-z e9032a2b2a TextBoxWidget: slightly better cursor positionning in RTL text 4 years ago
poire-z 588c35967f TextBoxWidget: minor optimisations
It's best to do all free'ing via :free(), and not :onCloseWidget(),
as :free() is more logically called in cascade when upper widgets
are closed.
4 years ago
Mihai Vasiliu e8f91ab399 [UX] ru keyboard ё popup and translation (#5662)
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
4 years ago
poire-z 3d191490d0
Touch zones: fix loss of overrides when re-registering a zone (#5658)
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.
5 years ago
Mihai Vasiliu 2541440bb8 [UX] Add Romanian keyboard layout (#5660)
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. :)
5 years ago
Mihai Vasiliu 849bd951ed [UX] Add Moldavian diacritics to ru_keyboard (#5652)
Added Ӂӂ on the Russian layout popup for Moldavian.
5 years ago
poire-z a1247160a1 TextWidget: minor optimisations
Also fix possible crash with NumberPickerWidget.
5 years ago
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.
5 years ago
Robert e4dd1826fa Translate file size unit (#5651)
Close #5649
5 years ago
Robert 494b38e9c8 [fix] Dictionary font size: avoid crash in reader mode (#5650) 5 years ago
Robert b0738960df Dictionary: add menu item to set font size (#5647) 5 years ago
poire-z 397211644d Keyboard: properly handle keyboard layout height change
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.
5 years ago
poire-z 13fa6d962c Korean keyboard: unwrap InputText on layout change
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.
5 years ago
Martín Fernández 5a28cbd630 android: add /sdcard/fonts 5 years ago
Robert a96114d14a Remove DRCOUNTMAX (#5644) 5 years ago
Robert 2161a76ea8 fix util.secondsToHClock when hmsFormat is true (#5640) 5 years ago
Robert d93206a841 Remove DCREREADER_PROGRESS_BAR (#5641) 5 years ago
NiLuJe 4778d3db3b
[RFC] Switch remaining keyboard icons to glyphs (#5639)
* 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
5 years ago
poire-z f410315f83 Screensaver: avoid crash when no lastfile 5 years ago
NiLuJe d8e0b1759b
Other minor frontend.util cleanups (#5629)
* Resync fixUtf8 w/ upstream
* Fix lastIndexOf desc
* Drop unichar usage, it's a crappier unicodeCodepointToUtf8 ;).
5 years ago
NiLuJe e0f14a336e
Rewrite unicodeCodepointToUtf8 w/ bitopt (#5625)
* Rewrite unicodeCodepointToUtf8 w/ bitopt

Avoids costly divs & modulos
5 years ago
yparitcher 6d3e7fcef6 [fix] PDF footer margins (#5620)
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.
5 years ago
Robert 03fda96041 [fix] Empty directory path and crash on TextWidget (#5606) 5 years ago
Frans de Jonge 7775233688
[fix] Prevent xtext crash by not freeing TextWidget prematurely (#5616)
Fixes <https://github.com/koreader/koreader/issues/5614>.
5 years ago
Robert e655616876 Cloud storage UX improvements (#5613)
* Overwrite confirmbox order

* Restore confirmbox option to read the downloaded book
5 years ago
Frans de Jonge 15fe0fef07
[chore] Extract Cyrillic/Russian keyboard (#5610)
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
5 years ago
Frans de Jonge 67b57834da
[lang] Minor touchups (#5611) 5 years ago
Robert 04741d8cfd [feat] Synchronize local folder with dropbox (#5591)
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.
5 years ago
yparitcher 5e8d1227ef [feat, UX] Pick keyboard layout from keyboard (#5583)
* Tap goes to next activated keyboard.
* Hold opens a selection popup.
5 years ago
Frans de Jonge 50878eab9e
[fix] Tailor plurals match (#5603)
Fixes #5601.
5 years ago
poire-z 89c0bd0886 ConfigDialog: allow larger toggle title text
Avoid a few truncated text, as some fit when allowed
to bite a bit on the (large) left padding.
5 years ago
poire-z 558bd1ebeb cre fonts list: ignore nerdfonts/symbol.ttf
It's rejected anyway by crengine, this just avoids
an error from being logged.
5 years ago
poire-z dc8696bd34 TextBoxWidget: add new properties, use them in Menu
- 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.
5 years ago
poire-z e699a1ee22 TextBoxWidget: use xtext for text shaping
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.
5 years ago
poire-z 22e3e34c45 TextWidget: use xtext for text shaping
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
5 years ago
poire-z c2e2c00db6 Font rendering: add some helpers for use by xtext
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).
5 years ago
poire-z 272d8857a2 TextBoxWidget: fix two minor bugs 5 years ago
poire-z 0fb780ea21 PicDocument: log reason of opening failure 5 years ago