2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

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".
This commit is contained in:
poire-z 2018-07-24 21:01:45 +02:00 committed by GitHub
parent 00cfc469f1
commit d8d0def122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 15 deletions

View File

@ -63,12 +63,12 @@ function ReaderTypeset:onReadSettings(config)
G_reader_settings:readSetting("copt_page_margins") or
DCREREADER_CONFIG_MARGIN_SIZES_MEDIUM)
-- default to enable floating punctuation
-- default to disable floating punctuation
-- the floating punctuation should not be boolean value for the following
-- expression otherwise a false value will never be returned but numerical
-- values will survive this expression
self.floating_punctuation = config:readSetting("floating_punctuation") or
G_reader_settings:readSetting("floating_punctuation") or 1
G_reader_settings:readSetting("floating_punctuation") or 0
self:toggleFloatingPunctuation(self.floating_punctuation)
-- default to disable TXT formatting as it does more harm than good

View File

@ -503,6 +503,9 @@ end
function BookInfoManager:removeNonExistantEntries()
self:openDbConnection()
local res = self.db_conn:exec("SELECT bcid, directory || filename FROM bookinfo")
if not res then
return _("Cache is empty. Nothing to prune.")
end
local bcids = res[1]
local filepaths = res[2]
local bcids_to_remove = {}

View File

@ -146,7 +146,7 @@ describe("Readerfooter module", function()
local timeinfo = footer.textGeneratorMap.time()
local page_count = readerui.document:getPageCount()
-- stats has not been initialized here, so we get na TB and TC
assert.are.same('1 / '..page_count..' | '..timeinfo..' | => 0 | B:0% | R:0% | TB: na | TC: na',
assert.are.same('1 / '..page_count..' | '..timeinfo..' | => 0 | B:0% | R:1% | TB: na | TC: na',
footer.footer_text.text)
end)
@ -545,7 +545,7 @@ describe("Readerfooter module", function()
assert.is.same(0, footer.text_width)
tapFooterMenu(fake_menu, "Progress percentage")
assert.are.same('R:0%', footer.footer_text.text)
assert.are.same('R:1%', footer.footer_text.text)
assert.is.same(false, footer.has_no_mode)
assert.is.same(footer.footer_text:getSize().w + footer.text_left_margin,
footer.text_width)

View File

@ -18,7 +18,7 @@ describe("ReaderLink module", function()
}
readerui.rolling:onGotoPage(5)
readerui.link:onTap(nil, {pos = {x = 340, y = 70}})
assert.is.same(41, readerui.rolling.current_page)
assert.is.same(39, readerui.rolling.current_page)
end)
it("should jump to links in pdf page mode", function()
@ -55,7 +55,7 @@ describe("ReaderLink module", function()
}
readerui.rolling:onGotoPage(5)
readerui.link:onTap(nil, {pos = {x = 340, y = 70}})
assert.is.same(41, readerui.rolling.current_page)
assert.is.same(39, readerui.rolling.current_page)
readerui.link:onGoBackLink()
assert.is.same(5, readerui.rolling.current_page)
end)

View File

@ -186,13 +186,13 @@ describe("Readerrolling module", function()
it("should show pages for different word gap", function()
readerui.document:setSpaceCondensing(100)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(208, readerui.document:getPageCount())
assert.are.same(191, readerui.document:getPageCount())
readerui.document:setSpaceCondensing(75)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(205, readerui.document:getPageCount())
assert.are.same(189, readerui.document:getPageCount())
readerui.document:setSpaceCondensing(50)
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
assert.are.same(199, readerui.document:getPageCount())
assert.are.same(189, readerui.document:getPageCount())
end)
end)

View File

@ -67,14 +67,14 @@ describe("Readersearch module", function()
it("should find the last occurrence", function()
-- local logger = require("logger")
-- logger.info("nb of pages", doc:getPageCount())
-- 20180613: currently 199 pages (20180602 was 200, was 202 before)
-- 20180723: currently 189 pages
for i = 100, 180, 10 do
rolling:onGotoPage(i)
local words = search:searchFromEnd("Verona")
assert.truthy(words)
local pageno = doc:getPageFromXPointer(words[1].start)
-- logger.info("last match on page", pageno)
assert.truthy(pageno > 195)
assert.truthy(pageno > 185)
end
for i = 230, 235, 1 do
rolling:onGotoPage(i)

View File

@ -22,10 +22,10 @@ describe("Readertoc module", function()
assert.are.same(2, toc_max_depth)
end)
it("should get toc title from page", function()
title = toc:getTocTitleByPage(51)
title = toc:getTocTitleByPage(49)
DEBUG("toc", toc.toc)
assert(title == "SCENE V. A hall in Capulet's house.")
title = toc:getTocTitleByPage(154)
title = toc:getTocTitleByPage(143)
assert(title == "SCENE I. Friar Laurence's cell.")
end)
describe("getTocTicks API", function()
@ -68,12 +68,12 @@ describe("Readertoc module", function()
end)
it("should get page left of chapter", function()
assert.truthy(toc:getChapterPagesLeft(10, 0) > 10)
assert.truthy(toc:getChapterPagesLeft(101, 0) > 10)
assert.truthy(toc:getChapterPagesLeft(92, 0) > 10)
assert.are.same(nil, toc:getChapterPagesLeft(200, 0))
end)
it("should get page done of chapter", function()
assert.truthy(toc:getChapterPagesDone(12, 0) < 5)
assert.truthy(toc:getChapterPagesDone(99, 0) < 5)
assert.truthy(toc:getChapterPagesDone(95, 0) < 5)
assert.truthy(toc:getChapterPagesDone(204, 0) > 10)
end)
describe("collasible TOC", function()