Commit Graph

28 Commits (master)

Author SHA1 Message Date
NiLuJe 788ccac561
Input/Device: Refactor Gyro events handling (#9935)
* Get rid of the `canToggleGSensor` Device cap, it's now mandatory for `hasGSensor` devices. (This means Kindles can now toggle the gyro, fix #9136).
* This also means that `Device:toggleGSensor` is now implemented by `Generic`.
* Update the Screen & Gyro rotation constants to be clearer (c.f., https://github.com/koreader/koreader-base/pull/1568) (/!\ This might conceivably break some `rotation_map` user-patches).
* Input: Move the platform-specific gyro handling to Device implementations, and let Input only handle a single, custom protocol (`EV_MSC:MSC_GYRO`).
* Input: Refine the `rotation_map` disable method implemented in 43b021d37c. Instead of directly poking at the internal field, use a new method, `disableRotationMap` (/!\ Again, this might break some `rotation_map` user-patches).
* Input: Minor tweaks to event adjust hooks to make them more modular, allowing the Kobo implementation to build and use a single composite hook. API compatibility maintained with wrappers.
1 year ago
zwim 486d7071c7
[StatusBar] Allow status bars to be repainted if they are not covered (#9768) 1 year ago
NiLuJe dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
2 years ago
NiLuJe d56a944b79 Tests: Handle FM/ReaderUI instances slightly more sanely
* Tear down FM instances properly
* Don't manhandle ReaderUI too much, and document when the tests do
  actively broken shit, like bypassing safeties to open two // ReaderUI
  instances.
3 years ago
NiLuJe 9cda84ef2f Prevent Busted from blowing up on cdata finalizers by properly closing
opened documents...
3 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 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
poire-z 4740ab1fdc
bump crengine: round FT metrics, split text drawing by script (#5628)
Includes:
- Fonts: round FT metrics instead of floor'ing them
- Fonts: switch to no hinting when native hinting fails
- Fonts: fix issue with Harfbuzz fallback font drawing
- Text: split measuring and word drawing by unicode script
- Page splitting: fix small memory leak
- Fix "background-color: black" ignored on inline elements
- Fix decoding of recent MOBI files
- Hardcoded elements list: add <font>
base/xtext.cpp: small cleanup, no logic change
5 years ago
poire-z 6baa2af5fb
cre: use 'best' (Harfbuzz) as the default kerning method (#5553)
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).
5 years ago
Robert 69ee8c48cc Fix: Status bar hides text with minimal bottom margin (#5135)
With very narrow bottom margin text is sometimes hidden by status bar.
5 years ago
poire-z 9f3c85ed83 cre: toggable enhanced rendering (floats, collapsed margins...)
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.

Also make available the added "HTML5" stylesheet to the Style menu.
5 years ago
poire-z 1657c5e412
bump crengine: hyphenation, kerning and epub.css fixes (#5043)
Includes:
- Freetype kerning: fix possible unstable rendering
- Hyphenation: fix one-letter patterns, update French.pattern
- Hyphenation: update French.pattern
- epub.css: add style for empty-line (used on text files)
5 years ago
Frans de Jonge 87b6217696
[fix, spec] readerrolling_spec: rename onDoubleTapForward/Backward to GotoNextChapter/PrevChapter (#4693)
See https://github.com/koreader/koreader/pull/4692#issuecomment-468689490
5 years ago
poire-z f2a9ed0b79
bump crengine: count nb of images drawn & others (#4542)
Includes:
- Update french hyphenation pattern
- epub.css: update style for 'blockquote'
- DrawBuf: count nb of images and surface drawn

Adds Document:getDrawnImagesStatistics() to help deciding
if refresh with (possibly costly) dithering should be used
(on devices with HW dithering capabilities) with CreDocument:
when a page contains enough images to benefit from it.
5 years ago
poire-z 98c3f0d366
bump crengine: fix max image height, handle <epub:switch> (#4390)
Includes:
- (Upstream) Fix dangerous compile warnings
- Fix max image height to prevent spurious page breaks
- Hide <epub:case> in <epub:switch>, show only <epub:default>

Adds a style tweak to show <epub:case> and hide <epub:default>
for the curious person.
5 years ago
poire-z ea946d52d6 bump crengine: tables rendering improvements and others
bump crengine, which includes:
- Adds support for symbol fonts (local or embedded)
- Fix some issues when rendering text in constrained width
- Page splitting: fix possible missing blocks
- CSS: adds support for 'auto', ignore % for borders
- Fix right border drawing position
- Fix: adds missing properties in copystyle()
- Adds comments, erm_killed rendering method
- Adds getRenderedWidths(): get node min/max node content width
- Tables rendering: fixes and improvements
- getRenderedWidths: enable min_width to be a single CJK char
- Fix wrong text wrap avoid in some case
- epub.css: add style for 'blockquote'
- Fix rendering issue when line ends with an image

Adds a few style tweaks related to tables.

Enforce table width: 100% in Wikipedia EPUBs to keep
previous look, which feels better with the various kinds
of tables in Wikipedia pages.

Fix unit tests as juliet.epub (full of blockquotes), grew quite
a few pages with the epub.css update.
6 years ago
poire-z d8d0def122
Floating punctuation: change default to disabled (#4101)
It was enabled by default, but it's mostly only needed for CJK users.
Furthermore, when floating punctuation is enabled, some rendering
issues exist (text right alignment, variable margins...) that
only CJK developpers could really fix. So, best to disable it and
avoid these rendering issues for most users.

Also: fix CoverBrowser crash when "Delete cache database"
followed by "Prune cache of removed books".
6 years ago
Robert f372dd752b Unit tests: word gap - space condensing (#4036) 6 years ago
poire-z 9a0728e421
Style menu cleanup (#3996)
Use epub.css as the main default style, with all file formats
except FB2 (which needs fb2.css).
(epub.css has been cleaned recently to be more conforming to HTML
specs and to not include class name based styles - with conditional
compatiblity styles for previously opened documents. It should be
usable on all HTML based documents, except FB2 which has some
incompatible specs.)

Consider all shipped css files other than "epub.css" and "fb2.css"
obsolete, and put them in a sub-menu (these other css files have
not been updated in the same way, and are kept as-is for when a
previously opened document requests one of them).

Add an icon indicating which style is set as default (like it's
been done for the Font and Style tweaks menus).

Also set the font size of the full status bar (available with
cre documents) when the setting "cre_header_status_font_size"
is present in settings.reader.lua (to add manually).
6 years ago
Frans de Jonge e3c17aa6d0 Travis: run luacheck on unit tests (#3059)
* Travis: run luacheck on unit tests
7 years ago
Qingping Hou abbb72b6d3 readerrolling(fix): do not emit PageUpdate event until document is ready 8 years ago
chrox 7ea12c0198 fix broken unit tests on Travis CI
1. It turns out that `device_id` is not defined in unit test environment
which makes the `assert(self.kosync_device_id)` fail and somehow makes `luajit` segmentation fault.
2. In the device spec, stubbing `io.open` will make subsquent `require`
all return boolean value and segmentation fault `luajit`.

This patch is a minimum viable change that makes CI work on both my
local box and Travis.
8 years ago
Qingping Hou d7b1b403c1 progresswidget(fix): ignore nil self.last 8 years ago
Qingping Hou 572412b1f6 readerrolling(fix): detect end of book properly 8 years ago
Qingping Hou c22a3747d8 fix all the tests 8 years ago
Qingping Hou 11d5b5c0a1 fix(readerlink): restore reader view context on go back 8 years ago
Qingping Hou 8c01835458 fix: only show reader status at the end of the book 8 years ago
chrox b422eb90cc refactoring readerrolling
and fix lossing progress when switching screen mode
10 years ago