mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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).
This commit is contained in:
2
base
2
base
Submodule base updated: db0f8e31fe...8840d09cc8
@@ -127,7 +127,7 @@ function ReaderFont:onReadSettings(config)
|
||||
self.ui.document:setFontHinting(self.font_hinting)
|
||||
|
||||
self.font_kerning = config:readSetting("font_kerning")
|
||||
or G_reader_settings:readSetting("copt_font_kerning") or 1 -- freetype (default in cre.cpp)
|
||||
or G_reader_settings:readSetting("copt_font_kerning") or 3 -- harfbuzz (slower, but needed for proper arabic)
|
||||
self.ui.document:setFontKerning(self.font_kerning)
|
||||
|
||||
self.space_condensing = config:readSetting("space_condensing")
|
||||
|
||||
@@ -385,7 +385,7 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
name_text = S.FONT_KERNING,
|
||||
toggle = {S.OFF, S.FAST, S.GOOD, S.BEST},
|
||||
values = {0, 1, 2, 3},
|
||||
default_value = 1,
|
||||
default_value = 3,
|
||||
args = {0, 1, 2, 3},
|
||||
event = "SetFontKerning",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
@@ -394,7 +394,7 @@ Note that your selected font size is not affected by this setting.]]),
|
||||
- off: no kerning.
|
||||
- fast: use FreeType's kerning implementation (no ligatures).
|
||||
- good: use HarfBuzz's light kerning implementation (faster than full but no ligatures and limited support for non-western scripts)
|
||||
- best: use HarfBuzz's full kerning implementation (slower, but may support ligatures with some fonts).
|
||||
- best: use HarfBuzz's full kerning implementation (slower, but may support ligatures with some fonts; also needed to properly display joined arabic glyphs and some other scripts).
|
||||
|
||||
(Font Hinting may need to be adjusted for the best result with either kerning implementation.)]]),
|
||||
},
|
||||
|
||||
@@ -317,8 +317,8 @@ describe("Readerfooter module", function()
|
||||
assert.are.same(359, footer.text_width)
|
||||
|
||||
footer:onPageUpdate(100)
|
||||
assert.are.same(189, footer.progress_bar.width)
|
||||
assert.are.same(391, footer.text_width)
|
||||
assert.are.same(197, footer.progress_bar.width)
|
||||
assert.are.same(383, footer.text_width)
|
||||
end)
|
||||
|
||||
it("should support chapter markers", function()
|
||||
|
||||
@@ -99,9 +99,9 @@ describe("Readerhighlight module", function()
|
||||
end)
|
||||
it("should response on tap gesture", function()
|
||||
tap_highlight_text(readerui,
|
||||
Geom:new{ x = 151, y = 115 },
|
||||
Geom:new{ x = 300, y = 285 },
|
||||
Geom:new{ x = 120, y = 240 })
|
||||
Geom:new{ x = 130, y = 100 },
|
||||
Geom:new{ x = 350, y = 395 },
|
||||
Geom:new{ x = 80, y = 265 })
|
||||
Screen:shot("screenshots/reader_tap_highlight_text_epub.png")
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("ReaderLink module", function()
|
||||
document = DocumentRegistry:openDocument(sample_epub),
|
||||
}
|
||||
readerui.rolling:onGotoPage(4)
|
||||
readerui.link:onTap(nil, {pos = {x = 340, y = 110}})
|
||||
readerui.link:onTap(nil, {pos = {x = 320, y = 120}})
|
||||
assert.is.same(36, readerui.rolling.current_page)
|
||||
end)
|
||||
|
||||
@@ -57,7 +57,7 @@ describe("ReaderLink module", function()
|
||||
document = DocumentRegistry:openDocument(sample_epub),
|
||||
}
|
||||
readerui.rolling:onGotoPage(4)
|
||||
readerui.link:onTap(nil, {pos = {x = 340, y = 110}})
|
||||
readerui.link:onTap(nil, {pos = {x = 320, y = 120}})
|
||||
assert.is.same(36, readerui.rolling.current_page)
|
||||
readerui.link:onGoBackLink()
|
||||
assert.is.same(4, readerui.rolling.current_page)
|
||||
|
||||
@@ -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(251, readerui.document:getPageCount())
|
||||
assert.are.same(231, readerui.document:getPageCount())
|
||||
readerui.document:setSpaceCondensing(75)
|
||||
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
|
||||
assert.are.same(242, readerui.document:getPageCount())
|
||||
assert.are.same(229, readerui.document:getPageCount())
|
||||
readerui.document:setSpaceCondensing(50)
|
||||
readerui:handleEvent(Event:new("ChangeScreenMode", "portrait"))
|
||||
assert.are.same(233, readerui.document:getPageCount())
|
||||
assert.are.same(225, readerui.document:getPageCount())
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("Readertoc module", function()
|
||||
title = toc:getTocTitleByPage(60)
|
||||
DEBUG("toc", toc.toc)
|
||||
assert.is.equal("SCENE V. A hall in Capulet's house.", title)
|
||||
title = toc:getTocTitleByPage(187)
|
||||
title = toc:getTocTitleByPage(177)
|
||||
assert.is.equal("SCENE I. Friar Laurence's cell.", title)
|
||||
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(97, 0) > 10)
|
||||
assert.truthy(toc:getChapterPagesLeft(90, 0) > 10)
|
||||
assert.are.same(nil, toc:getChapterPagesLeft(290, 0))
|
||||
end)
|
||||
it("should get page done of chapter", function()
|
||||
assert.truthy(toc:getChapterPagesDone(11, 0) < 5)
|
||||
assert.truthy(toc:getChapterPagesDone(95, 0) < 5)
|
||||
assert.truthy(toc:getChapterPagesDone(83, 0) < 5)
|
||||
assert.truthy(toc:getChapterPagesDone(290, 0) > 10)
|
||||
end)
|
||||
describe("collasible TOC", function()
|
||||
|
||||
Reference in New Issue
Block a user